Skip to content

Instantly share code, notes, and snippets.

Avatar

Zack Zatkin-Gold zg

View GitHub Profile
View math_str_eval.py
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
View 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 Feb 9, 2013
A PHP implementation of Google two-factor authentication.
View class.Google2FA.php
<?
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 Dec 30, 2012
unreal cloak.c
View 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 Jul 26, 2011
Part of cloak.c from UnrealIRCd
View cloak.c
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 Jul 22, 2011
Login/Register
View database.php
<?php
//require this to get a database connection
$connect = mysql_connect('localhost','test','test');
mysql_select_db('test');
?>
@zg
zg / npc-xml.php
Created Jul 22, 2011
Something to do with NPCs and XML...
View npc-xml.php
<?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>
View class.Highscores.php
<?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'
);
View class.db.php
<?php
/*********************************************************************
* Database Abstraction Layer
**********************************************************************
* Related Files:
* --------------------------------------------------------------
**********************************************************************
* Revision History:
* --------------------------------------------------------------
You can’t perform that action at this time.