This file contains hidden or 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/zsh | |
| set -e | |
| if [ $# -lt 3 ] | |
| then | |
| echo "Not Enough Arguments" | |
| return 1 | |
| fi |
This file contains hidden or 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 php | |
| <?php | |
| if( count($argv) < 3 ) { | |
| echo "Requires at least two arguments\n"; | |
| die(1); | |
| } | |
| $dir = realpath($argv[1]); | |
| if( !is_dir($dir) ) { |
This file contains hidden or 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
| package utils | |
| import ( | |
| "net/http" | |
| ) | |
| func BasicAuth(handler http.Handler, username, password string) http.HandlerFunc { | |
| return func(w http.ResponseWriter, r *http.Request) { | |
| if u, p, ok := r.BasicAuth(); !ok || !(u == username && p == password) { | |
| w.Header().Set("WWW-Authenticate", "Basic realm=\"ZorkIrc\"") |
This file contains hidden or 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 php | |
| <?php | |
| `git fetch -p --all`; | |
| $branches = `git branch -vv`; | |
| preg_match_all('%^\ +(?P<branch>[\w/=\-.#]+)\ +(?P<hash>[0-9a-fA-F]+)\ \[[\w/=\-.#]+:\sgone\]%smx', $branches, $result, PREG_PATTERN_ORDER); | |
| foreach( $result['branch'] as $index => $branch ) { | |
| $output = [ ]; |
This file contains hidden or 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 | |
| $timeout = 1800; //seconds | |
| $sleep = 100000; //microseconds | |
| $start = time(); | |
| $link = mysql_connect('[[HOST]]', '[[USERNAME]]', '[[PASSWORD]]'); | |
| if( !$link ) { | |
| die('Could not connect: ' . mysql_error()); | |
| } |
This file contains hidden or 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 php | |
| <?php | |
| $data = $argv[1]; | |
| $split = str_split($data); | |
| foreach($split as $ord) { | |
| echo "\\x" . dechex(ord($ord)); | |
| } |
This file contains hidden or 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 | |
| function arrays_are_similar( $aSide, $bSide ) { | |
| $keys = array_unique(array_merge( | |
| array_keys($aSide), | |
| array_keys($bSide) | |
| )); | |
| foreach( $keys as $key ) { |
This file contains hidden or 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
| @mixin scaled-sprite-background($name, $scale, $spritemap) { | |
| background: $spritemap; | |
| $spritePath: sprite-path($spritemap); | |
| @include background-size(image-width($spritePath) * $scale); | |
| $position: sprite-position($spritemap, $name); | |
| background-position: (nth($position, 1) * $scale) (nth($position, 2) * $scale); | |
| height: image-height(sprite-file($spritemap, $name)) * $scale; |
This file contains hidden or 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 | |
| # Requires a POSIX-ish shell. | |
| # | |
| # Originally From: http://hayne.net/MacDev/Bash/show_getinfo | |
| # | |
| # show_getinfo | |
| # This script opens the Finder's "Get Info" window | |
| # for the file or folder specified as a command-line argument. |
This file contains hidden or 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 | |
| date_default_timezone_set('America/Chicago'); | |
| $subject = file_get_contents("http://penny-arcade.com/dlc"); | |
| preg_match_all('%<li[ >].*?<h4>(?P<title>.*?)</h4>.*?class="paDLCLink"[^>]href="(?P<file>.*?)".*?</li%si', $subject, $result, PREG_SET_ORDER); | |
| header('Content-Type: application/rss+xml'); | |
| echo '<?xml version="1.0" encoding="UTF-8"?>'; |