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
| #! /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 | |
| $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 | |
| `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
| 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 | |
| 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
| #!/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 | |
| mb_internal_encoding('UTF-8'); | |
| $string = ''; | |
| if( count($argv) > 1 ) { | |
| $string .= implode(' ', array_slice($argv, 1)); | |
| } else { | |
| while( $line = fgets(STDIN) ) { |
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
| tell application "iTunes" | |
| (* this prevents an error on no tracks being found on the set below *) | |
| set played count of first track where played count = 1 to 0 | |
| (* sometimes it leaves this if we don't wait *) | |
| delay 1 | |
| set played count of every track where played count = 0 and played date ³ (date "Thursday, June 1, 2000 at 12:00:00 AM") to 1 | |
| end tell |
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 main | |
| import ( | |
| "fmt" | |
| "strconv" | |
| "strings" | |
| ) | |
| var input = `bn RSHIFT 2 -> bo | |
| lf RSHIFT 1 -> ly |