Skip to content

Instantly share code, notes, and snippets.

View jleeothon's full-sized avatar

Johnny Lee-Othon jleeothon

  • Wunderflats
  • Berlin
View GitHub Profile
@jleeothon
jleeothon / todaysentry.sh
Created May 13, 2016 09:24
Create a markdown file with today's date
touch `date +"%Y.%m.%d.md"`
workspaceparent="$HOME"
# needs to be run after cortobootstrap.sh
cd "$workspaceparent/cortoproject"
git clone https://github.com/cortoproject/python-binding
cd python-binding
# virtual environment
python3 -m venv --without-pip env
source env/bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python
@jleeothon
jleeothon / pyvenv-ubuntu.sh
Created December 12, 2015 23:29
pyvenv for ubuntu (apparently it's broken in 14.04) in cloud9
# I use this script in cloud9
/usr/bin/python3 -m venv --without-pip env
source env/bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python
deactivate
source env/bin/activate
@jleeothon
jleeothon / cortobootstrap.sh
Last active December 30, 2015 19:56
Set up Corto playground
workspaceparent="$HOME"
cd $workspaceparent
mkdir cortoproject
cd cortoproject
git clone https://github.com/cortoproject/corto
git clone https://github.com/cortoproject/c-binding
git clone https://github.com/cortoproject/xml
git clone https://github.com/cortoproject/corto-language
git clone https://github.com/cortoproject/io
@jleeothon
jleeothon / methodmissinghash.rb
Created April 19, 2015 23:59
Ruby dynamically resolve names from a hash
def respond_to? method_sym, include_private = false
if @a.has_key? method_sym
true
else
super method_sym, include_private
end
end
def method_missing method_sym, *arguments, &block
if @a.has_key? method_sym
@jleeothon
jleeothon / repeatexperiment.vb
Created April 17, 2015 13:43
Repeat a certain experiment for queue models
Sub RepeatExperiment()
'
' RepeatExperiment Macro
'
'
For i=0 To 40
Sheets("Simulación").Select
Sheets("Simulación").Copy After:=Sheets(Sheets.Count)
Range("B2").Select
@jleeothon
jleeothon / min.rb
Created March 31, 2015 19:28
Minimum distance between clusters of nodes
class Node
def distance_to cluster
self.reduce(nil) do |min, i|
cluster.reduce(min) do |min, j|
d = i.distance_to j
min = if min.nil? or min > d then d else min end
end
end
end
end
@jleeothon
jleeothon / Preferences.sublime-settings
Created March 28, 2015 19:23
Sublime preferences
{
"font_size": 12,
"ignored_packages":
[
"Vintage"
],
"translate_tabs_to_spaces": true,
"rulers": [80],
"remember_open_files": false,
"hot_exit": false,
unsigned int fibonacci(unsigned int n) {
if (n > 2) {
unsigned int a = 1, b = 1;
while (n-- > 2) {
b = a + b;
a = b - a;
}
return b;
} else if (n) {
return 1;
@jleeothon
jleeothon / urls.py
Last active August 29, 2015 14:12
CRUD URL Design with Python
# settings.py
APPEND_SLASH = True
# projectname/urls.py
from django.conf.urls import include
from django.conf.urls import patterns
from django.conf.urls import url