Author: sepedatua

Hey, I'm SepedaTua — a self-taught programmer and sysadmin in my early 40s, running CrushEdge to share the fixes I wish I'd found faster. I spend my days wrestling WordPress, WooCommerce, Linux servers, PHP, Python, and whatever else small-business sites throw at me. After years of trial-and-error (and way too many late-night server crashes), I document the solutions that actually work — safely, with backups first, and no unnecessary fluff. Outside the terminal, I'm a dad to four awesome kids, married to my best friend, and still squeezing in some video games when the house quiets down. If you're stuck on a problem, grab a coffee and let's sort it out together.
Hey, I'm SepedaTua — a self-taught programmer and sysadmin in my early 40s, running CrushEdge to share the fixes I wish I'd found faster. I spend my days wrestling WordPress, WooCommerce, Linux servers, PHP, Python, and whatever else small-business sites throw at me. After years of trial-and-error (and way too many late-night server crashes), I document the solutions that actually work — safely, with backups first, and no unnecessary fluff. Outside the terminal, I'm a dad to four awesome kids, married to my best friend, and still squeezing in some video games when the house quiets down. If you're stuck on a problem, grab a coffee and let's sort it out together.

How to automate FTP-ing file to another FTP account?

We will be using shell script to automate the transfer between two FTP accounts. You’ll need shell access to the source FTP account. #!/bin/bash directory=”/home/raisya/public_html” filename=”test.txt” hostname=”ftp.destination.com” username=”dest” password=”qwerty” logfile=”ftpf.log” ftp -uni $hostname <>$logfile quote USER $username quote PASS $password lcd $directory put $filename quit EOF Explanation: directory=”/home/raisya/public_html” Assigning “/home/raisya/public_html” to directory. filename=”test.txt” Assigning “test.txt” to filename. hostname=”ftp.destination.com” Assigning “ftp.destination.com”…

Read More »

How to grab BCA USD buy/sell rate with cURL?

This will grab current rate of USD rate from BCA using cURL. function delAttr($tagSource) { $stripAttrib = “‘ (style|class)=\”(.*?)\”‘i”; $tagSource = stripslashes($tagSource); $tagSource = preg_replace($stripAttrib, ”, $tagSource); return $tagSource; } function delTags($source) { $allowedTags=”; $source = strip_tags($source, $allowedTags); return preg_replace(‘/<(.*?)>/ie’, “‘<‘.delAttr(‘\\1′).’>'”, $source); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, “http://www.klikbca.com/individual/silver/ind/rates.html”); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_NOBODY, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,…

Read More »

How to create a jump to link

Jump link is used for jumping between part of a page. Wonder how to create a jump link? Ie: jump from the top of the page to the bottom? This will comes handy if you have a very long page. Or jump to top from the bottom of a page? Jump link consist two “HTML a” tags, the link &…

Read More »

PHP function to cut string into a specific length

PHP function to cut string into a specific length. Very useful for “Read More” links. function wCut($str, $maxLength = 40) { $strToCount = html_entity_decode($str); if (strlen($strToCount) <= $maxLength) { return $str; } $s2 = substr($strToCount, 0, $maxLength – 3); $s2 .= “…”; return htmlentities($s2); } $str = ‘Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nunc risus, euismod ac,…

Read More »