Skip to content

Instantly share code, notes, and snippets.

@boredzo
boredzo / colorman.zsh
Last active June 19, 2017 14:44 — forked from cocoalabs/gist:2fb7dc2199b0d4bf160364b8e557eb66
Color Terminal for bash/zsh etc..
man() {
env \
LESS_TERMCAP_md=$'\e[1;36m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[1;40;92m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[1;32m' \
man "$@"
}
@boredzo
boredzo / seeyouspacecowboy.sh
Last active July 21, 2018 17:47
A shell script to display SEE YOU SPACE COWBOY whenever you logout of your terminal!
#!/usr/bin/env bash
# SEE YOU SPACE COWBOY by DANIEL REHN (danielrehn.com)
# Displays a timeless message in your terminal with cosmic color effects
# Usage: add "sh ~/seeyouspacecowboy.sh; sleep 2" to .bash_logout (or similar) in your home directory
# (adjust the sleep variable to display the message for more seconds)
# Cosmic color sequence
@boredzo
boredzo / namegen.py
Last active April 12, 2016 05:46 — forked from fluffy-critter/namegen.py
Dissociator to generate names by example
#!/usr/bin/env python
#
# Based on https://gist.github.com/plaidfluff/aa9983161b2b56f8f2750d661279cb9e
#
# Silly thing to generate random names from examples. Uses the CSV files obtained from
# http://catalog.data.gov/dataset/baby-names-from-social-security-card-applications-national-level-data
#
# Any corpus will work if it's formatted like:
# Name,[ignored],weight
@boredzo
boredzo / gist:7647290
Last active December 29, 2015 08:59 — forked from cbarrett/gist:7647270
/* Let's say you want to list all of the options to your program as an enum */
enum Option {
OptionFoo,
OptionBar
}
/* You want to write a procedure to generate a help message for your program. Here's the loopless/countless way: */
int option = OptionFoo;
import requests
import os, re, sys
RE_SD_VIDEO = re.compile(
r'<a href="(http://devstreaming.apple.com/videos/wwdc/2013/[^"]*-SD.mov)')
RE_WEBVTT = re.compile(r'fileSequence[0-9]+\.webvtt')
# stdin: dump of https://developer.apple.com/wwdc/videos/
for l in sys.stdin:
m = RE_SD_VIDEO.search(l)
import requests
import os, re, sys
RE_SD_VIDEO = re.compile(
r'<a href="(http://devstreaming.apple.com/videos/wwdc/2013/[^"]*-SD.mov)')
RE_WEBVTT = re.compile(r'fileSequence[0-9]+\.webvtt')
# stdin: dump of https://developer.apple.com/wwdc/videos/
for l in sys.stdin:
m = RE_SD_VIDEO.search(l)
@boredzo
boredzo / gist:3224675
Created August 1, 2012 07:40 — forked from scottburton11/gist:3222152
Audio Compression for Voiceover

About compression

Audio compression is used to reduce the dynamic range of a recording. Dynamic range is the difference between the loudest and softest parts of an audio signal. It was originally used to guard against defects when cutting wax and vinyl phonograph records, but generally became useful as a way of increasing the loudness of an audio recording without achieving distortion.

The goal of most compression applications is to increase the amplitude of the softest parts of a recording, without increasing the amplitude of the loudest parts.

Compressor anatomy

Compressors generally all have the same conceptual parts. However, not all compressors present variable controls for all parts to the user. If you don't see all of your compressor's controls here, there's a chance it either has a fixed value (and no control), or is named something else:

@boredzo
boredzo / SSEnumeratorWithBlocks.m
Created March 17, 2012 06:57
Blocks for NSEnumerator
// Copyright (c) 2012 Colin Barrett, Springs & Struts <colin@springsandstruts.com>
// Released under the MIT license. http://www.opensource.org/licenses/mit-license.html
#import <Foundation/Foundation.h>
@interface NSEnumerator (SSEnumeratorWithBlocks)
- (void)ss_enumerateObjectsUsingBlock:(void (^)(id obj, BOOL *stop))enumBlock;
@end
@implementation NSEnumerator (SSEnumeratorWithBlocks)