Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
require 'octokit' | |
Octokit.pulls("rails/rails", :state => "all", :per_page => 1) | |
last_page = Octokit.last_response.rels[:last].href | |
count = Addressable::URI.parse(last_page).query_values["page"] |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
/* parallelize: reads commands from stdin and executes them in parallel. | |
The sole argument is the number of simultaneous processes (optional) to | |
run. If omitted, the number of logical CPUs available will be used. | |
Build: gcc -pthread parallelize.c -o parallelize | |
Demo: (for i in {1..10}; do echo "echo $i ; sleep 5" ; done ) | ./parallelize | |
By Marco Arment, released into the public domain with no guarantees. |
readlink.sh
is a pure shell implementation that uses dirname
, basename
, readlink
and pwd
utils.
Note that you cannot rename it to just readlink
as then the script will call itself instead of the system utility.
realpath
script simply calls Python's os.path.realpath
.
Python is provided in OS X and major Linux distributions.
You can use instead of the system utility by making a symlink: ln -s realpath readlink
.
Another way is to install coreutils
package via Homebrew or MacPorts and use greadlink
.
The code is taken from the following page on StackOverflow: http://goo.gl/Yw9OY
#!/bin/sh | |
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
# CREATE block and create them in separate commands _after_ all the INSERTs. | |
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
# The mysqldump file is traversed only once. | |
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |