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
| $ #remove all packages, except the ones I absolutely cannot live without | |
| $ brew uninstall $(comm -13 <((for package in $(echo sdl2 sdl2_{image,mixer,ttf} tmux pianobar pypy python python3 mongodb webkit2png cowsay git figlet); do echo $package; brew deps $package; done;) | sort -u -) <(brew list)) |
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 | |
| //PHP got the JSON_PRETTY_PRINT option for json_encode in 5.4, and I had to use a older version of PHP, | |
| // So I made this | |
| function json_pretty_encode($arr, $indent=" ", $characters=array(", ", ": "), $depth=0, $eol=PHP_EOL){ | |
| //You'd think that with the plethora of functions PHP has for array operations, they'd have one to check | |
| // if an array is associative or not | |
| // Now, I know what your saying "Oh, but, ALL arrays in PHP are associative!" Suck it, you know what I mean | |
| $is_assoc = (array_keys($arr) !== range(0,count($arr)-1)); | |
| end($arr); |
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 | |
| namespace os; | |
| define("DS", DIRECTORY_SEPARATOR); | |
| function walk($top){ | |
| $traverse = array($top); | |
| #foreach($traverse as &$dir){ | |
| for($i = 0; $i < count($traverse); $i++){ | |
| $dir = $traverse[$i]; | |
| $tuple = array($dir, array(), array()); | |
| //ignore this directory(we are iterating over it) and the parent directory |
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
| function selectElement(callback){ | |
| var selectorDiv = document.createElement("div"); | |
| var css = function(e, styles){ | |
| for(style in styles){ | |
| if(styles.hasOwnProperty(style)) | |
| e.style[style.replace(/-(.)/g, function(a,b){return b.toUpperCase();})] = styles[style]; | |
| } | |
| }; | |
| var pos = function(e){ | |
| var pos = {"left": e.offsetLeft, "top": e.offsetTop}; |
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
| javascript:(function(){var d=function(a,c){for(style in c)c.hasOwnProperty(style)&&(a.style[style.replace(/-(.)/g,function(a,c){return c.toUpperCase()})]=c[style])};(function(a){var c=document.createElement("div");d(c,{border:"1px solid hsl(240, 80%, 70%)",background:"hsla(240, 50%, 90%,0.5)",top:"0",left:"0",width:"0",height:"0",display:"none","pointer-events":"none",position:"absolute","z-index":"1000",transition:"width 0.5s, height 0.5s, top 0.5s, left 0.5s"});document.body.appendChild(c);var b=function(a){a= a.target;if(a!=c){for(var b=a,e=b.offsetLeft,f=b.offsetTop;b=b.offsetParent;)e+=b.offsetLeft,f+=b.offsetTop;d(c,{top:f+"px",left:e+"px",display:"block",width:a.offsetWidth-2+"px",height:a.offsetHeight-2+"px"})}},g=function(d){d.preventDefault();d.stopPropagation();a(d.target);document.removeEventListener("mouseover",b);document.removeEventListener("mousedown",g);c.parentNode.removeChild(c);return!1};document.addEventListener("mouseover",b);document.addEventListener("mousedown",g)})(function(a){var c= |
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 python | |
| import time | |
| import subprocess | |
| import sys | |
| import random | |
| import fcntl, termios, struct | |
| import re | |
| message = "Mess with the best. Die like the rest" | |
| with open(sys.argv[1], "wb", 0) as tty: | |
| height, width = struct.unpack('hh', fcntl.ioctl(tty.fileno(), termios.TIOCGWINSZ, '1234')) |
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
| /** | |
| * NOTE: Because Chrome doesn't elevate the permissions | |
| * of snippets, we can't push the image out to the browser | |
| * using canvas.toDataURL(), we have to add it to the page | |
| * and have the user right-click and save-as | |
| */ | |
| var css = function(el, styles){ | |
| for (var style in styles) { | |
| if(!styles.hasOwnProperty(style)) continue; | |
| el.style[style] = styles[style]; |
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
| LIBS=`sdl2-config --libs` `pkg-config SDL2_image --libs` | |
| CFLAGS=`sdl2-config --cflags` `pkg-config SDL2_image --cflags` | |
| all: main.o | |
| gcc -o main main.o $(LIBS) -Wall | |
| main.o: main.c | |
| gcc -o main.o -c main.c $(CFLAGS) -Wall | |
| clean: | |
| rm main.o main |
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
| // | |
| // Pack.cpp | |
| // | |
| // Created by Nick Beeuwsaert on 5/17/14. | |
| // Copyright (c) 2014 Nick Beeuwsaert. | |
| // MIT Licensed. | |
| // | |
| #include "Pack.h" | |
| #include <stdarg.h> |
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
| /** | |
| * Compile with `gcc -o anagram main.c -std=c99` | |
| **/ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <ctype.h> | |
| typedef struct { | |
| char *human_readable; |