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
#!/bin/bash | |
# locks the users screen using dbus. | |
dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock |
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
#!/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 |
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
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' |
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
#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}; |
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
#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, |
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
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() |
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
$('<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 |
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
/* | |
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! | |
*/ |
NewerOlder