Getting started:
Related tutorials:
| #!/bin/sh | |
| # | |
| # Adam Sharp | |
| # Aug 21, 2013 | |
| # | |
| # Usage: Add it to your PATH and `git remove-submodule path/to/submodule`. | |
| # | |
| # Does the inverse of `git submodule add`: | |
| # 1) `deinit` the submodule | |
| # 2) Remove the submodule from the index and working directory |
| #!/bin/bash | |
| # Copied from https://apple.stackexchange.com/questions/191879/how-to-find-the-currently-connected-network-service-from-the-command-line | |
| services=$(networksetup -listnetworkserviceorder | grep 'Hardware Port') | |
| while read line; do | |
| sname=$(echo $line | awk -F "(, )|(: )|[)]" '{print $2}') | |
| sdev=$(echo $line | awk -F "(, )|(: )|[)]" '{print $4}') | |
| #echo "Current service: $sname, $sdev, $currentservice" | |
| if [ -n "$sdev" ]; then | |
| ifout="$(ifconfig $sdev 2>/dev/null)" |
| #!/bin/bash | |
| # Copied from https://apple.stackexchange.com/questions/191879/how-to-find-the-currently-connected-network-service-from-the-command-line | |
| services=$(networksetup -listnetworkserviceorder | grep 'Hardware Port') | |
| while read line; do | |
| sname=$(echo $line | awk -F "(, )|(: )|[)]" '{print $2}') | |
| sdev=$(echo $line | awk -F "(, )|(: )|[)]" '{print $4}') | |
| #echo "Current service: $sname, $sdev, $currentservice" | |
| if [ -n "$sdev" ]; then | |
| ifout="$(ifconfig $sdev 2>/dev/null)" |
| #!/bin/sh | |
| # Install Homebrew | |
| ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| # Install Homebrew Cask | |
| brew tap caskroom/versions | |
| # Install Docker | |
| brew cask install docker |
| #!/bin/bash | |
| # Install Homebrew | |
| ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| # Install Cask | |
| brew tap caskroom/versions | |
| # Install the latest version of Java | |
| brew cask install java |
| require 'rubygems' | |
| require 'json' | |
| LOADBALANCER = 'your-elb-load-balancer-name' | |
| lb_instances = %x( aws elb describe-instance-health --load-balancer-name #{LOADBALANCER} ) | |
| lb_instances = JSON.parse(lb_instances) | |
| instances = lb_instances["InstanceStates"] |
| #!/bin/bash | |
| # Script for restoring backed up database that was moved to the RAM Disk. | |
| if [ $(uname) = "Linux" ]; then | |
| # Delete detached symlink | |
| [ -L /var/lib/mysql ] && sudo rm -rf /var/lib/mysql | |
| # Restore backups | |
| [ -d /var/lib/mysql.bak ] && sudo cp -pRL /var/lib/mysql.bak /var/lib/mysql | |
| else | |
| echo "Unsupported platform." | |
| fi |
| SET FOREIGN_KEY_CHECKS = 0; | |
| SET GROUP_CONCAT_MAX_LEN=32768; | |
| SET @tables = NULL; | |
| SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables | |
| FROM information_schema.tables | |
| WHERE table_schema = (SELECT DATABASE()); | |
| SELECT IFNULL(@tables,'dummy') INTO @tables; | |
| SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables); | |
| PREPARE stmt FROM @tables; |
Getting started:
Related tutorials:
Picked these from here
| Command | Note |
|---|---|
| Ctrl + a | go to the start of the command line |
| Ctrl + e | go to the end of the command line |
| Ctrl + k | delete from cursor to the end of the command line |