Quantcast
Channel: [CWH] Code Snips
Browsing all 15 articles
Browse latest View live

MySQL Find And Replace

UPDATE `tbl_name` SET tbl_field = replace(tbl_field, 'FIND', 'REPLACE');

View Article



Create A MySQL User

GRANT ALL PRIVILEGES ON `db_name.table_name` (or .*) TO 'username'@'localhost' IDENTIFIED BY 'password';

View Article

CSS Debug

* { outline:2px dotted red } * * { outline:2px dotted green } * * * { outline:2px dotted orange } * * * * { outline:2px dotted blue } * * * * * { outline:1px solid red } * * * * * * { outline:1px solid...

View Article

HTML5 Starter Page

<!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <title>My Site</title> <!--[if lte IE 8]> <script...

View Article

Show Each Process Memory Usage

ps axu Show full command in ps display: ps axu --width=500

View Article


Show Process CPU Usage

Display how much CPU a process is using: ps -eo pcpu,pid -o comm= | sort -k1 -n -r | head -1 For example, show top five CPU using processes: ps -eo pcpu,pid -o comm= | sort -k1 -n -r | head -5 Which...

View Article

Install CSF (Firewall) And LFD (Log File Daemon)

cd /usr/src/ wget http://www.configserver.com/free/csf.tgz tar -xzf csf.tgz cd csf sh install.sh

View Article

Send Email From Shell

mail -s "Subject" email@address.com < message.txt

View Article


Print Active Connections To Port 80 Per IP Address

netstat -plan | grep :80 | grep -E "(EST|LIST)" | awk {'print $5'} | cut -d: -f 1 | sort | uniq -c | sort -nk 1

View Article


Google API jQuery Include

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(function(){  }); </script>

View Article

Import MySQL Dump

mysql -h DBHOST -u DBUSER -pDBPASS DBNAME < dump.sql Replace text in uppercase with the appropriate information: DBHOST - Database hostname, usually localhost DBUSER - User with privileges to the...

View Article

Embed Audio Using The Audio Tag

<audio controls autoplay autobuffer src="song.mp3"></audio>

View Article

Find Duplicate MySQL Records

SELECT email, count(email) AS total FROM `tbl_mailing_list` GROUP BY email HAVING total > 1 ORDER BY total;

View Article


Validate Email Address With JavaScript

/^((([a-z]|d|[!#$%&'*+-/=?^_`{|}~]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])+(.([a-z]|d|[!#$%&'*+-/=?^_`{|}~]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])+)*)|((x22)((((x20|x09)*(x0dx0a))?(x20|x09)+)?(([x01...

View Article

Block IP Address

iptables -I INPUT -s 25.22.22.22 -j DROP

View Article

Browsing all 15 articles
Browse latest View live




Latest Images