This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @link http://tools.ietf.org/html/draft-nottingham-http-problem | |
* @link http://tools.ietf.org/html/rfc5988 | |
* | |
* @package ApiProblem | |
* @category Exception | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls data/some_path_with_spaces_in_the_name/*.csv| while read name; do | |
./bin/load_csv.sh "$name" table_name | |
done | |
# Only show lines when the value in column number 6 changes. | |
tail -f some-logfile.log | awk '{if (last!=$6) {print $0}; last=$6}' | |
#generates php class properties from a tables columns | |
mysql -B -N -u root my_db -e 'describe table_to_use'|awk '{printf(" \"%s\" => null,\n", $1) }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
usort($unsortedObjectArray, function( $a, $b ) { | |
if ($a->weight == $b->weight) { | |
return 0; | |
} | |
return ($a->weight < $b->weight) ? -1 : 1; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Converts any integer into a base [BASE] number. I have chosen 62 | |
# as it is meant to represent the integers using all the alphanumeric | |
# characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
# | |
# I plan on using this to shorten the representation of possibly long ids, | |
# a la url shortenters | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tracker = ga.getByName('tracker') | |
tracker.get('clientId') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u username dbname -e 'describe db_table'|awk '{print " protected $"$1";"};' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ZONE="my-tld.com" | |
RESOURCE="some-host" | |
INTERFACE="eth0" | |
ADDR=$(ifconfig $INTERFACE | grep "inet addr" | awk -F: '{print $2}' | awk '{print$1}') | |
cli53 rrcreate $ZONE $RESOURCE A $ADDR -x 3600 -r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Disabled</key> | |
<false/> | |
<key>KeepAlive</key> | |
<false/> | |
<key>Label</key> | |
<string>com.zircote.headlessvm</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jinja2 import Template | |
import json | |
import httplib2 | |
import argparse | |
TEMPLATE = """ | |
user www-data; | |
worker_processes 4; | |
pid /run/nginx.pid; | |
daemon off; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COMPOSER=$(type -p "composer.phar") | |
if [ -x "${COMPOSER}" ]; then | |
${COMPOSER} self-update > /dev/null | |
else | |
$(type -p "php") -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));" | |
fi | |
${COMPOSER} $@ |