Skip to content

Instantly share code, notes, and snippets.

--===================================================
--= Niklas Frykholm
-- basically if user tries to create global variable
-- the system will not let them!!
-- call GLOBAL_lock(_G)
--
--===================================================
function GLOBAL_lock(t)
local mt = getmetatable(t) or {}
mt.__newindex = lock_new_index
@outro56
outro56 / gist:20915d7e65ee2f27a03a
Last active August 29, 2015 14:22
Find the top X frequent numbers in a stream
//Find the top X frequent numbers in a stream
// http://www.cs.berkeley.edu/~satishr/cs270/sp11/rough-notes/Streaming-two.pdf
// Returns the top numbers k and their frequencies in the set
// Complexity:
// space = O(k)
// time = O(N)
map<int, int> getFreq(k, Set) {
A = map<int, int>
for (k : getTop(k, Set) {
@outro56
outro56 / .profile
Last active August 29, 2015 14:21 — forked from tamlyn/.profile
Terminal setup for windows using Console2 (http://sourceforge.net/projects/console/)
# always list in long format
alias ls='ls -la --color'
alias clear=cls
# set dynamic prompt and window/tab title
PS1='\[\e]0;${PWD##*/}\a\]\n' # set window title
#PS1="$PS1"'\u@\h ' # user@host<space>
PS1="$PS1"'\[\033[32m\]' # change color
PS1="$PS1"'\w' # current working directory
if test -z "$WINELOADERNOEXEC"
@outro56
outro56 / vagrant-devenv-provision.sh
Last active August 29, 2015 14:21
Provision development image
#!/usr/bin/env bash
echo "Provisioning virtual machine..."
sudo apt-get update
sudo apt-get install -y python-software properties
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:webupd8team/java