Skip to content

Instantly share code, notes, and snippets.

View unbracketed's full-sized avatar

Brian Luft unbracketed

View GitHub Profile

Keybase proof

I hereby claim:

  • I am unbracketed on github.
  • I am brianluft (https://keybase.io/brianluft) on keybase.
  • I have a public key ASDA8arUp9wX5w0-kz7yGMdizo_BF-XSpQ-OtIPuddcBrQo

To claim this, I am signing this object:

@unbracketed
unbracketed / RC300_sync.py
Last active July 11, 2019 04:26
Utility for managing BOSS RC-300 memory slots and settings
import csv
import os
import shutil
import logging
log = logging.getLogger(__name__)
UPLOAD_QUEUE = "~/.rc300-queue.csv"
RC300_BASE = "/Volumes/BOSS_RC-300/ROLAND/"
@unbracketed
unbracketed / branch-fu.md
Created April 7, 2015 17:49
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
@unbracketed
unbracketed / Matches.jsx
Last active August 29, 2015 14:17
Riff on Omniscient-style component
//http://omniscientjs.github.io/playground/02-search/
// content component (pure)
var Match = React.createClass({
render: () => {(
<li>
<a href="{this.props.url}">{this.props.title}</a>
</li>
)}
})
@unbracketed
unbracketed / heroku-copy-config.sh
Created November 26, 2014 18:04
Heroku copy config
#!/bin/bash
set -e
sourceApp="$1"
targetApp="$2"
while read key value; do
key=${key%%:}
echo "Setting $key=$value"
@unbracketed
unbracketed / yyyymmdd.js
Last active August 29, 2015 14:06
Javascript date formatter YYYYMMDD
Date.prototype.yyyymmdd = function() {
var yyyy = this.getFullYear().toString();
var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
var dd = this.getDate().toString();
return yyyy + '-' + (mm[1]?mm:"0"+mm[0]) + '-' + (dd[1]?dd:"0"+dd[0]);
};
d = new Date();
@unbracketed
unbracketed / empty_tests_init_files.sh
Last active December 28, 2015 11:28
Find all __init__ modules for packages named 'tests' and clear their contents
find . \
-path "*/tests/*" \
-type f \
-name "__init__.py" \
-exec sh -c 'echo "" > {}' \;
@unbracketed
unbracketed / gist:6027277
Last active February 25, 2022 09:28
Using Tmux Sessions for Managing Multiple Project / Computing Workspaces

Some fellow Tmux users I spoke with weren't using the Sessions feature, which I think is one of the coolest features of Tmux. No faulting the Tmux developers for very complete documentation, but it can take a few read-throughs for some of us before the core architecture becomes clear:

  1. The Tmux Server is a collection of Sessions.
  2. A Session is a collection of Windows.
  3. A Window is a collection of Panes which visually subdivide it in the terminal.
  4. Windows and Panes can be moved and shared between Windows, including Windows in other Sessions.

Having used a modern web browser, you already understand principles 1-3. You can open multiple browser windows (Tmux Session), each browser window has multiple tabs (Tmux Window), and each tab has a web page which probably contains multiple visual sections (Tmux Pane).

Go Get Some Popcorn

I was working on what I thought would be a not-too-dirty and not-too-premature snippet of code to cache some rendered Django templates when I realized it was going to be more complicated and in fact a little uglier than what I'd hoped. "Oh well" I thought, and decided to move on to more critical tasks. First though, to go grab some popcorn (the radioactive looking yellow stuff from Popcorn Factory in case you're wondering).

Not surprisingly, while in the kitchen it hit me that I was thinking about the problem incorrectly and that the solution was at hand. Welcome back, quick psychological win! I assume most people are aware now of the consequences of distractions on productivity. Another part of being effective is changing your context (physical surroundings, environment, etc.). I suspect many of us with technical or creative careers overlook this important aspect.

Researchers still have a lot to piece together about how the different subsystems in our brains work together, but evid

@unbracketed
unbracketed / flotplot.ipynb
Created October 24, 2012 14:43 — forked from crbates/flotplot.ipynb
self contained flot plotting in an ipython notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.