Skip to content

Instantly share code, notes, and snippets.

@prozacgod
prozacgod / synchro.js
Created June 9, 2011 20:43
node.js synchronize multiple actions
/*
A simple and elegant function to synchronize multiple functions that expect callback as their last parameter.
example:
sync(func1, [parms], func2, func3, func4, [parms], callback);
Public domain!!
please leave me a comment if you like it!
*/
@prozacgod
prozacgod / gogShelf.js
Last active August 29, 2015 13:56
Render your GOG shelf to html for posterity.
$('<textarea>').width('800').height('800').val((function(){ var games = $('#shelfGamesList .shelf_game'), username=prompt("Username:")+"'s Shelf"; return "<html><head><title>" + username + "</title><style>body,html{font-family:Arial;background-color:#000;color:#FFF;margin:0;padding:0}\n.shelf_title{font-weight:700;position:relative;width:828px;background-color:#555;text-align:center;margin:0 auto;padding:10px}\n.count{position:absolute;right:15px}\n.shelf_outer{width:828px;background-color:#555;margin:10px auto}\n.shelf_outer:last-child:after{content:" +'""'+ ";display:table;clear:both}\n.game{float:left;border-bottom:15px solid #777;padding:15px 5px}\n.shelf_title a {position: absolute;left:15px;}</style><body><div class='shelf_title'><a href='https://gist.github.com/prozacgod/9032048'>gogShelf.js</a>" + username +"<span class='count'>" + games.length + " Games</span></div><div class='shelf_outer'>" + Array.prototype.slice.call(games.map(function(i, el) { return "<div class='game'><a href='http://www.gog.com
import random
# expects a file named "allwords.txt" in the current directory and words are full caps
data = [s.strip() for s in open("allwords.txt", 'r').read().split("\n")]
def weightedRandom(weightedSet):
keys = weightedSet.keys()
keys.sort()
@prozacgod
prozacgod / sig.c
Created May 2, 2015 03:50
My obfuscated signature that is much to large to be a signature, so it can sit here.
#include <stdio.h>
char v[5]="-=#%@",s[120*32]; void st(int x,int y) {if(((y)>=0)&&((y)<32)&&((x)
>=0)&&((x)<120))s[(y)*120+(x)]=1;}char gt(int x,int y){return s[(y)*120+(x)];}
char S[45]={0,3,7,10,14,17,21,24,28,31,34,37,41,44,47,50,53,56,59,62,64,67,69,
72,74,77,79,81,83,85,87,88,90,91,93,94,95,96,97,98,98,99,99,100,100}; int hs(
int a){return a<90?S[a/2]:S[44-((a-90)/2)];}int sn(int a){return a%360<180?hs(
a%180):-hs(a%180);} int PZ[] = {0x7ffe,0x8001,0x8001,0x7f39,0x0129,0x0139,
0x0101,0x0101,0x00fe,0x7ffe,0x8001,0x8001,0x7f39,0x0329,0x7c39,0x8001,0x8301,
0x7cfe,0x7ffe,0x8001,0x8001,0x8ff1,0x9009,0x8ff1,0x8001,0x8001,0x7ffe,0x7c0e,
0x8311,0x80d1,0x8031,0x8001,0x8c01,0x8b01,0x88c1,0x703e,0x7ffe,0x8001,0x8001,
@prozacgod
prozacgod / sig_uni.c
Created May 4, 2015 16:40
unicode version of my previous sig.c, 120x32 pixel grid using unicode block chars. (less obfuscation)
#include <stdio.h>
char s[120*32];
const char * _S[] = {" ","▘","▝","▀","▖","▌","▞","▛","▗","▚","▐","▜","▄","▙","▟","█"};
void st(int x,int y) {if(((y)>=0)&&((y)<32)&&((x)>=0)&&((x)<120))s[(y)*120+(x)]=1;}
char gt(int x,int y) {return s[(y)*120+(x)];}
char S[45]={0,3,7,10,14,17,21,24,28,31,34,37,41,44,47,50,53,56,59,62,64,67,69,72,74,77,79,81,83,85,87,88,90,91,93,94,95,96,97,98,98,99,99,100,100};
import os, sys
import pygame
from pygame.locals import *
# this is for library initialization
pygame.init()
pygame.font.init()
if not pygame.font: print 'Warning, fonts disabled'
if not pygame.mixer: print 'Warning, sound disabled'
#!/bin/bash
# place in $HOME/bin
# with startup scripts in $HOME/bin/startup/00_asdf
# marked executable.
# To be executed during startup in users crontab, loads an environment similar to what
# the user expects in the normal bash prompt.
[ -s "/etc/bash.bashrc" ] && . /etc/bash.bashrc
#!/bin/bash
# locks the users screen using dbus.
dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock
<!DOCTYPE html>
<html>
<head>
<title>Simple Electron App</title>
<meta name="viewport" content="initial-scale=1, user-scalable=yes" />
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<script src='index.js'></script>
<style>
html, body {
overflow: hidden;

Keybase proof

I hereby claim:

  • I am prozacgod on github.
  • I am prozacgod (https://keybase.io/prozacgod) on keybase.
  • I have a public key whose fingerprint is 7980 85CD 60DC DF93 0332 4524 6A32 C92C 1592 EF16

To claim this, I am signing this object: