Skip to content

Instantly share code, notes, and snippets.


Michael Lockhart sinewalker

View GitHub Profile
Wilfred / init.lua
Created Jun 8, 2021
switch to firefox with hammerspoon
View init.lua
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "F", function()
local app = hs.application'firefox'
if app ~= nil then
jsomers /
Created Sep 27, 2018
Using websockets to easily build GUIs for Python programs

Using websockets to easily build GUIs for Python programs

I recently built a small agent-based model using Python and wanted to visualize the model in action. But as much as Python is an ideal tool for scientific computation (numpy, scipy, matplotlib), it's not as good for dynamic visualization (pygame?).

You know what's a very mature and flexible tool for drawing graphics? The DOM! For simple graphics you can use HTML and CSS; for more complicated stuff you can use Canvas, SVG, or WebGL. There are countless frameworks, libraries, and tutorials to help you draw exactly what you need. In my case, this was the animation I wanted:


(Each row represents a "worker" in my model, and each rectangle represents a "task.")

View Droplets.rb
use_bpm 144
# Droplets
# Coded by Adam Baranec
# 2018
live_loop :echoes do
use_synth :square
play ([:b3, :cs4, :ds4, :e4, :fs4, :gs4]).choose, cutoff: rrand(40, 100), amp: 0.5, attack: 0, release: 4, cutoff_max: 100
sleep [0.25, 0.5].choose
JoaquimLey /
Last active Jun 9, 2021
How to Work with GitHub and Multiple Accounts

Step 1 - Create a New SSH Key

We need to generate a unique SSH key for our second GitHub account.

ssh-keygen -t rsa -C "your-email-address"

Be careful that you don't over-write your existing key for your personal account. Instead, when prompted, save the file as id_rsa_COMPANY. In my case, I've saved the file to ~/.ssh/id_rsa_work.

Step 2 - Attach the New Key

#-- Script to automate
# Forked from the original to do the opposite: Switch ssh repo urls to https
# Original here:
# Thanks to @m14t
#origin or upstream
REPO_URL=`git remote -v | grep -m1 "^$REMOTE" | sed -Ene's#.*([^[:space:]]*).*#\1#p'`
jasongilman /
Last active May 24, 2021
This describes how I setup Atom for Clojure Development.

Atom Clojure Setup

This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.

Install Atom

Download Atom

The Atom documentation is excellent. It's highly worth reading the flight manual.

orta /
Last active Nov 7, 2016
Notes on Spacemacs

Start out

install via

  brew tap railwaycat/homebrew-emacsmacport
  brew install emacs-mac --with-spacemacs-icon  # OR, brew cask install emacs-mac
  brew linkapps


karlingen / switch_user.php
Last active Apr 23, 2021
SugarCRM user switching / login as another user
View switch_user.php
* Login as another user in SugarCRM and switch back to admin user
* Simply put this file into a custom entry point file and
* browse to it with the parameters 'user_name' or 'back_to_sudo'
* Usage:
* http://xxxxxxxxx/index.php?entryPoint=my_awesome_entry_point&user_name=mylittlepony
* http://xxxxxxxxx/index.php?entryPoint=my_awesome_entry_point&back_to_sudo=1
#!/usr/bin/env perl
# Copyright (c) 2015 Sergey Lyubka
# All rights reserved
use Encode;
my $dir = "/Users/$ENV{USER}/.Trash";
sub read_file($) { local $/; open FD, $_[0] or die $_[0]; binmode FD; <FD>; }
cpq /
Created Jan 22, 2015
MacOS: restore all files from Trash folder to their original location
#!/usr/bin/env perl
# Copyright (c) 2015 Sergey Lyubka
# All rights reserved
use Encode;
my $dir = "/Users/$ENV{USER}/.Trash";
sub read_file($) { local $/; open FD, $_[0] or die $_[0]; binmode FD; <FD>; }