An introduction to curl using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
An introduction to curl using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.
http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| #!/bin/bash | |
| # my git difftool, calls FileMerge with project as -merge target | |
| # better than using opendiff | |
| # | |
| # cd to your project dir and and run difftool like this: | |
| # git difftool -d -x gdiff | |
| # find top level of git project | |
| dir=$PWD | |
| until [ -e "$dir/.git" ]; do |
| def equi(a) | |
| lower_elements_sum = 0 | |
| higher_elements_sum = a.inject(:+) | |
| a.each_with_index do |el, i| | |
| lower_elements_sum += a[i - 1] if i > 0 | |
| higher_elements_sum -= el | |
| return i if lower_elements_sum == higher_elements_sum | |
| end |
| <% | |
| require 'socket' | |
| # @return [String] public IP address of workstation used for egress traffic | |
| def local_ip | |
| @local_ip ||= begin | |
| # turn off reverse DNS resolution temporarily | |
| orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true | |
| UDPSocket.open do |s| |
| #!/bin/bash | |
| # | |
| # this script will attempt to detect any ephemeral drives on an EC2 node and create a RAID-0 stripe | |
| # mounted at /mnt. It should be run early on the first boot of the system. | |
| # | |
| # Beware, This script is NOT fully idempotent. | |
| # | |
| METADATA_URL_BASE="http://169.254.169.254/latest" |
| Using the nc command you can scan a port or a range of ports to verify whether a UDP port is open and able to receive traffic. | |
| This first command will scan all of the UDP ports from 1 to 65535 and add the results to a text file: | |
| $ nc -vnzu server.ip.address.here 1-65535 > udp-scan-results.txt | |
| This merely tells you that the UDP ports are open and receive traffic. | |
| Perhaps a more revealing test would be to actually transfer a file using UDP. |