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 | |
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 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 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 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 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 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 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
$the_cow = <<"EOC"; | |
$thoughts | |
$thoughts | |
$thoughts | |
$thoughts _ | |
|\\ _/ \\ | |
| \\------/ , ) | |
| \\ | | | | |
\\ / / | |
___,--------____ / \\ |
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 | |
if __name__ == "__main__": | |
print("Why do programmers confuse Halloween and Christmas?"); | |
print("Because oct %o == dec %d!"%(25, 031)); |
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
all: main.c | |
gcc -o main main.c -I/opt/X11/include/cairo -I/opt/X11/include/pixman-1 -I/opt/X11/include -I/opt/X11/include/freetype2 -I/opt/X11/include -I/opt/X11/include/libpng15 -I/opt/X11/include -I/usr/include/libxml2 -I/usr/local/Cellar/libsvg-cairo/0.1.6/include -I/usr/local/Cellar/libsvg/0.1.4/include -L/opt/X11/lib -L/usr/local/Cellar/libsvg-cairo/0.1.6/lib -L/usr/local/Cellar/libsvg/0.1.4/lib -lsvg-cairo -lsvg -lpng -ljpeg -lz -lxml2 -lcairo |
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
/* Reads a SVG file into a SDL_Texture | |
inputs: | |
SDL_Renderer *r: the SDL_Renderer to use, | |
const char *filename: the file to load | |
returns: | |
SDL_Texture*: the loaded texture, or NULL if something went wrong | |
*/ | |
SDL_Texture *SDL_TextureFromSVG(SDL_Renderer *r, const char *filename){ | |
SDL_Texture *texture = NULL; | |
SDL_Surface *tmpSurface = NULL; |