Skip to content

Instantly share code, notes, and snippets.

View zg's full-sized avatar

Zack Zatkin-Gold zg

View GitHub Profile
from __future__ import division
from pyparsing import (Literal,CaselessLiteral,Word,Combine,Group,Optional,
ZeroOrMore,Forward,nums,alphas,oneOf)
import math
import operator
__author__='Paul McGuire'
__version__ = '$Revision: 0.0 $'
__date__ = '$Date: 2009-03-20 $'
__source__='''http://pyparsing.wikispaces.com/file/view/fourFn.py
@zg
zg / tmux.md
Created December 6, 2013 01:05 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@zg
zg / class.Google2FA.php
Created February 9, 2013 08:30
A PHP implementation of Google two-factor authentication.
<?
class Google2FA {
const keyRegeneration = 30; // Interval between key regeneration
const otpLength = 6; // Length of the Token generated
private static $lut = array( // Lookup needed for Base32 encoding
"A" => 0, "B" => 1,
"C" => 2, "D" => 3,
"E" => 4, "F" => 5,
"G" => 6, "H" => 7,
"I" => 8, "J" => 9,
@zg
zg / cloak.c
Created December 30, 2012 02:36
unreal cloak.c
/*
* IRC - Internet Relay Chat, src/modules/cloak.c
* (C) 2004 The UnrealIRCd Team
*
* See file AUTHORS in IRC package for additional names of
* the programmers.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
@zg
zg / cloak.c
Created July 26, 2011 03:50
Part of cloak.c from UnrealIRCd
static char *hidehost_ipv4(char *host)
{
unsigned int a, b, c, d;
static char buf[512], res[512], res2[512], result[128];
unsigned long n;
unsigned int alpha, beta, gamma;
/*
* Output: ALPHA.BETA.GAMMA.IP
* ALPHA is unique for a.b.c.d
@zg
zg / database.php
Created July 22, 2011 06:59
Login/Register
<?php
//require this to get a database connection
$connect = mysql_connect('localhost','test','test');
mysql_select_db('test');
?>
@zg
zg / npc-xml.php
Created July 22, 2011 06:59
Something to do with NPCs and XML...
<?php
if(count($_GET) > 0)
{
$xmlstr = "<npcspawn>
<npcId>{$_GET['npcId']}</npcId>
<locationz>
<x>{$_GET['x']}</x>
<y>{$_GET['y']}</y>
<z>{$_GET['z']}</z>
</locationz>
@zg
zg / class.Highscores.php
Created July 22, 2011 06:59
Highscores class
<?php
class Highscores {
public $skills = array (
'attack','defence','strength','hitpoints','range',
'prayer','magic','cooking','woodcutting','fletching',
'fishing','firemaking','crafting','smithing','mining',
'herblore','agility','thieving','slayer','farming',
'runecraft',
'overall'
);
@zg
zg / class.db.php
Created July 22, 2011 06:59
db class
<?php
/*********************************************************************
* Database Abstraction Layer
**********************************************************************
* Related Files:
* --------------------------------------------------------------
**********************************************************************
* Revision History:
* --------------------------------------------------------------