Skip to content

Instantly share code, notes, and snippets.

View Uberi's full-sized avatar

Anthony Zhang Uberi

View GitHub Profile
@Uberi
Uberi / Tanks Backup.py
Created November 8, 2012 18:05
Mini Shooter Game for Pythonista (iOS)
from scene import *
import sound
class MyScene (Scene):
def setup(self):
# This will be called before the first frame is drawn.
self.root_layer = Layer(self.bounds)
self.bullets = {}
@Uberi
Uberi / gist:5474550
Created April 27, 2013 20:24
k-element permutation count.
import math
def permutation_count(k, n):
"Computes the number of k-element permutations in a sequence of length n."
return math.factorial(n) / math.factorial(n - k)
@Uberi
Uberi / Binary.ahk
Last active December 17, 2015 00:39
Functions for converting between binary, text, and integers.
;AHK v1
#NoEnv
/*
MsgBox % BinaryToText(Temp1 := TextToBinary("Test")) . "`n" . Temp1
MsgBox % BinaryToNumber(Temp1 := NumberToBinary(1234)) . "`n" . Temp1
*/
TextToBinary(ByRef InputText)
{
@Uberi
Uberi / Binary Heap.ahk
Last active December 22, 2015 10:28
Implementation of a simple and extensible binary heap.
#NoEnv
/*
Basic example:
Heap := new BinaryHeap
For Index, Value In [10,17,20,30,38,30,24,34]
Heap.Add(Value)
MsgBox % Heap.Peek()
Loop, 8
@Uberi
Uberi / Modster.ahk
Last active December 26, 2015 10:14
MODSTER source code. Check out the [forum topic](http://forum.minetest.net/viewtopic.php?id=6497)! Licensed under the AGPLv3.
#NoEnv
Gui, Font, s36, Arial
Gui, Add, Text, x10 y10 w760 h50 Center, MODSTER 2.0
Gui, Font, s12
Gui, Add, Groupbox, x10 y80 w760 h110, Where is the Minetest folder?
Gui, Font, s22
Gui, Add, Edit, x20 y110 w690 h40 vMinetestPath gCheckMinetest
Gui, Add, Button, x710 y110 w50 h40 gSelectMinetest, ...
@Uberi
Uberi / Waterloo LEARN Login.user.js
Last active January 4, 2016 03:29
This is a UserScript that fixes the most irritating thing about uWaterloo LEARN - the pointless, annoying alerts that your session is about to be logged out for the 50th time.
// ==UserScript==
// @name uWaterloo Learn Login
// @namespace uberi
// @description Keep the user logged into LEARN while the tab is open
// @include https://learn.uwaterloo.ca/*
// @match https://learn.uwaterloo.ca/*
// @version 1.0
// @run-at document-start
// ==/UserScript==
@Uberi
Uberi / BHR top 100 chrome hangs.ipynb
Last active January 28, 2016 22:31
Top 100 BHR chrome hangs on nightly, by occurrences, median, and total duration.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Uberi
Uberi / raycast3d.lua
Last active February 28, 2016 16:24
3D voxel raycasting example
raycast3D = function(pos, dir, callback)
local base = {x=math.floor(pos.x), y=math.floor(pos.y), z=math.floor(pos.z)}
local stepx, stepy, stepz = 0, 0, 0
local componentx, componenty, componentz = 0, 0, 0
local intersectx, intersecty, intersectz = 0, 0, 0
if dir.x == 0 then
intersectx = math.huge
elseif dir.x > 0 then
stepx = 1