Skip to content

Instantly share code, notes, and snippets.

# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
@mmurdoch
mmurdoch / Get Github Library.py
Last active April 29, 2023 19:45
Download github library for Pythonista.
# Note that this script attempts to delete directories (Folders) called 'temp' and 'dateutil'
# within Pythonista as part of installation. It will also overwrite files in directories
# named 'github' and 'githubista'. If you are using Pythonista 1.3 or above please check
# that you have not created any Folders with these names before running this script as
# any files inside them will be irretrievably lost.
import os
import urllib2
import tarfile
import shutil
import traceback
@mmurdoch
mmurdoch / base64.lua
Created September 30, 2012 08:20 — forked from paulmoore/base64.lua
Base64 in Lua
--- base64.lua
--
-- V0.3 for Lua 5.1
--
-- A full description of the specification can be found here: http://tools.ietf.org/html/rfc4648
--
-- To encode, use base64.encode(input), where input is a string of arbitrary bytes. The output is a Base64 encoded string.
-- To decode, use base64.decode(input), where input is a Base64 encoded string. The output is a string of arbitrary bytes.
--
-- The library will throw an error on invalid input, you can catch these as such:
import os, cmd, sys, re, glob, os.path, shutil, zipfile, tarfile, gzip
# Credits
#
# The python code here was written by pudquick@github
#
# License
#
# This code is released under a standard MIT license.
#
-- Copyright Matthew Murdoch
-- Remix under the terms of the MIT license (see http://opensource.org/licenses/MIT)
bounds = nil
circles = {}
function setup()
displayMode(FULLSCREEN)
physics.gravity(0, 0)
addBounds()
@mmurdoch
mmurdoch / Circle Bounce.lua
Last active December 20, 2015 12:39
Circle Bounce
-- Copyright Matthew Murdoch
-- Remix under the terms of the MIT license (see http://opensource.org/licenses/MIT)
Point = class()
function Point:init(x, y)
self._x = x
self._y = y
end
@mmurdoch
mmurdoch / Circle Bounce.py
Last active December 20, 2015 11:48
Circle Bounce
# Copyright Matthew Murdoch
# Remix under the terms of the MIT license (see http://opensource.org/licenses/MIT)
from random import *
from scene import *
class Rectangle(object):
def __init__(self, bottom_left, size):
self._rect = Rect(bottom_left.x, bottom_left.y, size.w, size.h)
self._fill_color = Color(0, 0, 0)
@mmurdoch
mmurdoch / Circle Move.py
Created July 29, 2013 07:48
Circle Move
from random import *
from scene import *
class Velocity(object):
def __init__(self, dx, dy):
self.dx = dx
self.dy = dy
class Circle(object):
def __init__(self, location, color, velocity):
@mmurdoch
mmurdoch / Circle Touch.py
Last active December 20, 2015 07:49
Circle Touch
# Copyright Matthew Murdoch
# Remix under the terms of the MIT license (see http://opensource.org/licenses/MIT)
from random import random
from scene import *
class Circle(object):
def __init__(self, location, color):
self.location = location
self.color = color
@mmurdoch
mmurdoch / Github Example.py
Created November 10, 2012 15:08
Example of using github library for Pythonista.
import console
import keychain
import traceback
from github import Github
def printRepository(username):
g = Github(username, getGithubPassword(username))
user = g.get_user()
repositories = user.get_repos()