Skip to content

Instantly share code, notes, and snippets.

@huyng
huyng / matplotlibrc
Created February 8, 2011 15:50
my default matplotlib settings
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
@mashdot
mashdot / msmtprc
Created May 6, 2012 14:27
mutt + offlineimap + msmtp +msmtpQ
#Time-stamp: <2012-05-06 Sun 16:07 msmtprc>
# This file must have no more than user read/write permissions.
account work
host mail.work.net
user [email protected]
password password
auto_from off
from [email protected]
maildomain work.net
@threedaymonk
threedaymonk / mandel.clj
Created September 11, 2012 20:32
UTF-8 Mandelbrot in Clojure
(def screen-width 100)
(def screen-height 30)
(defn scaled-x [x]
(- (* (/ x screen-width) 3.5) 2.5))
(defn scaled-y [y]
(- (* (/ y screen-height) 2) 1))
(defn mandel [x y iteration x0 y0 max-iteration]
@genegoykhman
genegoykhman / qb2ledger
Created September 22, 2012 04:19
Converts a QuickBooks General Journal CSV export to a ledger_cli compatible transaction file. More details at http://www.timetiger.com/gene/blog/2012/2012-09-23-an-alternative-to-quickbooks.html
#! /usr/bin/env ruby
require 'csv'
require 'Date'
require 'optparse'
SCRIPT_VERSION = [1, 0, 0]
class Transaction
attr_accessor :transaction_id, :type, :date, :num, :rows
def initialize
@simonjbeaumont
simonjbeaumont / tmup
Last active October 13, 2021 11:03
Update bash to latest tmux environment on reattaching.
#!/bin/bash
tmup ()
{
echo -n "Updating to latest tmux environment...";
export IFS=",";
for line in $(tmux showenv -t $(tmux display -p "#S") | tr "\n" ",");
do
if [[ $line == -* ]]; then
unset $(echo $line | cut -c2-);
@mwhite
mwhite / git-aliases.md
Last active November 18, 2024 15:39
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@Zulko
Zulko / limehouse_nights_moviepy.py
Last active September 14, 2017 20:37
Source for my music video on Gershwin's Limehouse Nights
"""
Code for a music video where sheet music is
scrolled transparently on my hands playing the
piano. See that effect here:
https://www.youtube.com/watch?v=V2XCJNZjm4w
"""
from moviepy.editor import *
@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active May 11, 2024 17:43
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@dpapathanasiou
dpapathanasiou / SchemaSpy-HOWTO.md
Last active February 17, 2024 19:45
How to use SchemaSpy to generate the db schema diagram for a PostgreSQL database

SchemaSpy is a neat tool to produce visual diagrams for most relational databases.

Here's how to use it to generate schema relationship diagrams for PostgreSQL databases:

  1. Download the jar file from here (the current version is v6.1.0)

  2. Get the PostgreSQL JDBC driver (unless your installed version of java is really old, use the latest JDBC4 jar file)

  3. Run the command against an existing database. For most databases, the schema (-s option) we are interested in is the public one:

@ctford
ctford / boids.cljs
Created March 31, 2015 20:24
Independent boids
(ns universe.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(def app-state (atom {:text "Hello Boids"
:birds (map vector
(repeatedly 20 #(rand-int 1000))
(repeatedly 20 #(rand-int 1000)))}))
(defn make-bird [[x y]]