Skip to content

Instantly share code, notes, and snippets.

View sweenzor's full-sized avatar

Matt Sweeney sweenzor

View GitHub Profile
@swaroopch
swaroopch / flask-boilerplate-tmux.bash
Created December 5, 2010 07:00
A command that scripts a tmux session
#!/bin/bash
function flask-boilerplate-tmux
{
# https://github.com/swaroopch/flask-boilerplate
BASE="$HOME/code/flask-boilerplate"
cd $BASE
tmux start-server
tmux new-session -d -s flaskboilerplate -n model
@mja
mja / homebrew_scipy.sh
Created December 13, 2010 08:09
Install numpy, scipy, and matplotlib on OS X 10.6
homebrew install gfortran
homebrew install python
homebrew install distribute
homebrew install pip
pip install ipython
pip install numpy
pip install scipy
pip install -f http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0/matplotlib-1.0.0.tar.gz matplotlib
@snuggs
snuggs / .tmux.conf
Last active August 22, 2024 14:22
IDE & TMUX Configuration
############################################################################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
# Cheatsheets:
# https://devhints.io/tmux
# `property not found` issue:
@lfborjas
lfborjas / gist:817504
Created February 8, 2011 23:12
Filter even numbers in a list; fork it for maximum fun!
#these are meant to be run in a REPL, and the java one in beanshell of something of the sort:
#ruby
[1,2,3,4].select{ |x| x.even? }
#python
[x for x in [1,2,3,4] if not x%2]
#or, more norvingly
filter(lambda x: not x%2, [1,2,3,4])
#clojure
@mbostock
mbostock / .block
Last active November 14, 2023 03:46
Google Maps + D3
license: gpl-3.0
--------- clients.py --------
class PikaPubSubPublishClient(object):
def __init__(self, host=settings.APP_MESSAGER_DEFAULT_HOST,
port=settings.APP_MESSAGER_DEFAULT_PORT,
virtual_host=settings.APP_MESSAGER_DEFAULT_VIRTUALHOST,
username=settings.APP_MESSAGER_DEFAULT_USERNAME,
password=settings.APP_MESSAGER_DEFAULT_PASSWORD,
exchange_name='ground',
@jpsilvashy
jpsilvashy / generate_bson_ids.rb
Created September 19, 2011 18:55
Generate 20 BSON Ids
#!/usr/bin/env ruby
# encoding: utf-8
require 'bson'
20.times do
puts BSON::ObjectId.new
end
@vgoklani
vgoklani / Viterbi.py
Created October 14, 2011 17:51
Viterbi algorithm for Hidden Markov Models (HMM) taken from wikipedia
#!/usr/bin/python
# http://en.wikipedia.org/wiki/Viterbi_algorithm
'''
Consider two friends, Alice and Bob, who live far apart from each other and who talk together daily over the telephone about what they did that day. Bob is only interested in three activities: walking in the park, shopping, and cleaning his apartment. The choice of what to do is determined exclusively by the weather on a given day. Alice has no definite information about the weather where Bob lives, but she knows general trends. Based on what Bob tells her he did each day, Alice tries to guess what the weather must have been like.
Alice believes that the weather operates as a discrete Markov chain. There are two states, "Rainy" and "Sunny", but she cannot observe them directly, that is, they are hidden from her. On each day, there is a certain chance that Bob will perform one of the following activities, depending on the weather: "walk", "shop", or "clean". Since Bob tells Alice about his activities, those are the observations. The entire
@simme
simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@hugowetterberg
hugowetterberg / geo-distance.coffee
Created November 3, 2011 09:31
Converts the distance between the WGS 84 coordinates pointA and pointB to meters.
###
Converts the distance between the WGS 84 coordinates pointA and pointB to meters.
Ported from http://groups.google.com/group/sci.geo.satellite-nav/msg/0bfca0bf8a986395
with the suggested radii-calculation optimization.
###
module.exports.WGS84DegreesToMeters = (pointA, pointB)->
radFactor = Math.PI/180
[lat1, lon1] = [pointA[0]*radFactor, pointA[1]*radFactor]
[lat2, lon2] = [pointB[0]*radFactor, pointB[1]*radFactor]