Skip to content

Instantly share code, notes, and snippets.

View leegao's full-sized avatar

Lee Gao leegao

  • Google
  • Jersey City, NJ
View GitHub Profile
function string.split(t,b)
local cmd = {}
local match = "[^%s]+"
if type(b) == "string" then match = "[^"..b.."]+" end
for word in string.gmatch(t, match) do table.insert(cmd, word) end
return cmd
end
function new_account(user,pw)
local file = assert(io.open("sys/lua/Fun Server/user_accounts/"..user..".txt","w"))
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@leegao
leegao / fabfile.py
Created April 27, 2010 01:54 — forked from heckj/fabfile.py
#!/usr/bin/env python
from __future__ import with_statement # needed for python 2.5
from fabric.api import *
from fabric.contrib.console import confirm
# ================================================================
# NOTE:
# using this fabfile expects that you have the python utility
# fabric installed locally, ssh access to reamea.com, and your
# ssh public key associated with the account 'mboza@reamea.com'
#include "ruby.h"
#include "Python.h"
// #include "sre.h"
#include "re.h"
#include "st.h"
#include "rubyio.h"
// #include "structmember.h" -- Clashes with Ruby
#include <string.h>
/*

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
Can you explain why the following occurs in Python? (The culprit is roundoff, but why does it seem like 1.1 is not affected but 1.2 is?)
>>> (1.1 + 1) - 1
1.1
>>> (1.2 + 1) - 1
1.2000000000000002
>>> 1.2 + (1 - 1)
1.2
Try the same with 1.3 and 1.4