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
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 "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> | |
/* |
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.
- Redirect to this link to request GitHub access:
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
#!/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' |
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
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
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
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")) |