Skip to content

Instantly share code, notes, and snippets.

View ksze's full-sized avatar
💭
Permanently poikilothermic

Kal Sze ksze

💭
Permanently poikilothermic
View GitHub Profile
@ksze
ksze / resample_flac.bash
Created April 15, 2013 16:41
A script to resample your FLAC files *and* make sure they conform to the FLAC Subset specification so they will play in pretty much all hardware players - e.g. portable music players like those made by COWON) - all this while minimizing the file sizes.
#!/usr/bin/env bash
# A script to resample your FLAC files *and* make sure they conform to the FLAC Subset
# specification so they will play in pretty much all hardware players - e.g. portable
# music players like those made by COWON - all this while minimizing file sizes.
# Requirements:
# - Bash 4 or newer (for the globstar)
# - sox
# - flac
@ksze
ksze / pip_upgrade_all.sh
Created December 14, 2012 13:48
A simple Bash script to upgrade all pip packages in a virtualenv.
#!/usr/bin/env bash
# INSTALLATION
# ------------
# Put this script in the bin directory of your virtualenv and make it user executable:
# $ cp pip_upgrade_all.sh /path/to/your_virtualenv/bin/
# $ chmod u+x /path/to/your_virtualenv/bin/pip_upgrade_all.sh
# USAGE
# -----
import sys
def same_row(i,j): return (i/9 == j/9)
def same_col(i,j): return (i-j) % 9 == 0
def same_block(i,j): return (i/27 == j/27 and i%9/3 == j%9/3)
class InconsistentPositionError(Exception):
pass
def still_consistent(a):