The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23/12/2008
- Revised date: 15/12/2013
- Original post
| // To be used in conjunction with [Magic Autofill](http://ctrlq.org/irctc/) | |
| /**************************** | |
| * TESTED ON CHROME ONLY. | |
| ****************************/ | |
| // Absolutely required function because of IRCTC's stupid ID naming scheme. | |
| function jq( myid ) { | |
| return "#" + myid.replace( /(:|\.|\[|\]|,)/g, "\\$1" ); | |
| } |
| #!/bin/bash | |
| ######################################### | |
| #Function: add a new swap partition | |
| #Usage: bash add_swap.sh | |
| #Author: Customer service department | |
| #Company: Alibaba Cloud Computing | |
| #Version: 2.1 | |
| ######################################### | |
| check_os_release() |
| #!/bin/bash | |
| mysql_status=`netstat -nl | awk 'NR>2{if ($4 ~ /.*:3306/) {print "Yes";exit 0}}'` | |
| PortNum=`netstat -lnt|grep 3306|wc -l` | |
| if [ "$mysql_status" == "Yes" ];then | |
| slave_status=`mysql -uroot -p123456 -e"show slave status\G" | grep "Running" | awk '{if ($2 != "Yes") {print "No";exit 1}}'` | |
| if [ "$slave_status" == "No" ];then | |
| echo "slave is not working!" | |
| [ ! -f "/tmp/slave" ] && echo "Slave is not working!" | mail -s "Warn!MySQL Slave is not working" [email protected] |
| # My preferred ls outputs | |
| ls -Alh --group-directories-first | |
| # Find and remove multiple files with same extension (careful!) | |
| find . -type f -name "*.txt" -exec rm -f {} \; | |
| # You can first view your current default audio device by typing: | |
| pactl stat | |
| # To check the current swappiness value: |
| #!/bin/sh | |
| # count=4096k -> 4G | |
| sudo dd if=/dev/zero of=/swapfile bs=1024 count=4096k | |
| mkswap /swapfile | |
| swapon /swapfile | |
| chown root:root /swapfile | |
| chmod 0600 /swapfile | |
| sysctl vm.swappiness=10 |
| #SSD only | |
| sudo vim /etc/fstab | |
| # remove relatime if present and add noatime | |
| #example UUID=3df036c6-8244-49d1-afe4-a3a808e32eeb / ext4 noatime,errors=remount-ro 0 1:x | |
| sudo vim /etc/udev/rules.d/99-ssd.rules | |
| # all non-rotational block devices use 'deadline' scheduler | |
| # mostly useful for SSDs on desktops systems | |
| SUBSYSTEM=="block", ATTR{queue/rotational}=="0", ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/scheduler}="deadline" |
| #!/usr/bin/env perl | |
| # | |
| # taken from https://stackoverflow.com/a/1075807/1972627 (Daniel Reeves) | |
| # slightly modified by tom hensel <[email protected]> | |
| # https://gist.github.com/gretel/c2ef247f51e3cf0c654e | |
| # | |
| # Use 'ssc' (this script) instead of 'ssh' to do your ssh logins. | |
| # Without a 3rd argument it will list available screens. | |
| # Given a 3rd argument it will either reattach an existing screen or create a new screen, | |
| # i.e. 'ssc host.tld session'. |
| tell application "Safari" | |
| if not (exists document 1) then return | |
| set theURL to URL of current tab of window 1 | |
| close current tab of window 1 | |
| end tell | |
| tell application "Google Chrome" | |
| if not (exists window 1) then | |
| reopen | |
| else |