Skip to content

Instantly share code, notes, and snippets.

@mcfadden
mcfadden / convert_xlive.sh
Last active January 8, 2022 01:40
Convert multitrack WAV files generated by X-Live card into one file per track
#!/bin/bash
# Accepts a single argument, which is a path to the directory containing all the
# WAV files generated by a recordings from the X-Live card.
# Looks for files like 000000.WAV 000001.WAV 000002.WAV etc.
#
# Outputs files like Ch01.WAV Ch02.WAV Ch03.WAV etc.
#
# Requires sox
@hustshawn
hustshawn / create-kube-user.sh
Last active December 4, 2020 12:19 — forked from henning/create-kube-user.sh
create k8s user, certificate, permissions and client config
#!/bin/bash
CLUSTERNAME=cluster-name
CLUSTER_API=cluster-api
NAMESPACE=namespace
USERNAME=username
ORGANIZATION=organization
KEY_FILE=$USERNAME.key
CSR_FILE=$USERNAME.csr
CRT_FILE=$USERNAME.crt
@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active October 21, 2022 20:10
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
@prwhite
prwhite / Makefile
Last active May 2, 2024 18:02
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
def not_in_student_group(user):
"""Use with a ``user_passes_test`` decorator to restrict access to
authenticated users who are not in the "Student" group."""
return user.is_authenticated() and not user.groups.filter(name='Student').exists()
# Use the above with:
@user_passes_test(not_in_student_group, login_url='/elsewhere/')
def some_view(request):
# ...
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 7, 2024 15:24
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@wickman
wickman / README.md
Created April 12, 2012 22:55
Python development in Pants (tutorial)

Python development using Pants

brian wickman - @wickman

[TOC]

Why use Pants for Python development?

Pants makes the manipulation and distribution of hermetically sealed Python environments

@mislav
mislav / aprompt.png
Last active February 11, 2024 06:40
My zsh prompt. No oh-my-zsh needed
aprompt.png
@eykd
eykd / .gitignore
Created January 19, 2012 04:37
Full stack BDD testing with Behave+Mechanize+Django
*.pyc
bin/
include/
lib/