Skip to content

Instantly share code, notes, and snippets.

View Birch-san's full-sized avatar

Birch-san

View GitHub Profile
@Birch-san
Birch-san / delete duplicate entries from Google Play Music user playlist.py
Created February 15, 2015 19:32
Delete duplicate entries from Google Play Music user playlist
from gmusicapi import Mobileclient
# Get gmusicapi: https://github.com/simon-weber/Unofficial-Google-Music-API
# This script iterates through all your playlists, and deletes any playlist entries that
# have a duplicate later on in the same playlist.
api = Mobileclient()
logged_in = api.login('email@sharklasers.com', 'nice try :P')
playlists = api.get_all_user_playlist_contents()
return "£"+(function compound(balanceAtYearBeginning, amountDepositedPerYear, coeff, pow, interestOnly, initialAmount) {
return pow // are we on base case or inductive case?
? compound(
(balanceAtYearBeginning + amountDepositedPerYear) * coeff, // apply year's interest to starting balance plus deposit
amountDepositedPerYear,
coeff,
pow-1,
interestOnly,
initialAmount || balanceAtYearBeginning
)
@Birch-san
Birch-san / Default (OSX).sublime-keymap
Created June 21, 2015 14:27
My Sublime keybindings
[
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+pagedown"], "command": "next_view" },
{ "keys": ["super+pagedown"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["ctrl+pageup"], "command": "prev_view" },
{ "keys": ["super+pageup"], "command": "prev_view" },
{ "keys": ["ctrl+1"], "command": "reveal_in_side_bar"},
{ "keys": ["ctrl+w"], "caption": "Selection: Expand to Brackets", "command": "expand_selection", "args": {"to": "brackets"}},
{ "keys": ["alt+up"], "caption": "Edit: Swap Line Up", "command": "swap_line_up" },
@Birch-san
Birch-san / .vimrc
Created August 18, 2015 10:41
Awesome vim syntax highlighting
"The following three lines map Ctrl+s to save in vi. You can comment
"these out, it has nothing to do with syntax highlighting or colors.
" optional lines to turn on pressing F2 to toggle paste mode
noremap <F2> :set invpaste paste?<CR>i
set pastetoggle=<F2>
:nmap <c-s> :w<CR>
:imap <c-s> <Esc>:w<CR>a
@Birch-san
Birch-san / .zshrc
Last active August 29, 2015 14:27
My customizations to .zshrc
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git sublime jsontools zsh-syntax-highlighting)
########
#http://superuser.com/questions/541366/way-to-move-cursor-by-arguments-in-bash
@Birch-san
Birch-san / Iterative compound interest calculator.js
Created February 26, 2016 23:32
Compound interest where interest is calculated daily, but credited monthly.
var finalAmount = (function() {
var initialPounds = 40000;
var denominationOfYearUponWhichInterestCalculated = 365;
var denominationsAfterWhichInterestCredited = Math.floor(denominationOfYearUponWhichInterestCalculated/12);
var annnualInterestCoefficient = 1.05;
var denominationInterestCoefficient = Math.pow(annnualInterestCoefficient, 1/denominationOfYearUponWhichInterestCalculated);
var yearsSimulated = 5;
var amountSpentPerMonth = 500;
var amountSpentPerYear = amountSpentPerMonth*12;
var amountSpentPerDenomination = amountSpentPerYear/denominationOfYearUponWhichInterestCalculated;
@Birch-san
Birch-san / stat_2_Sierra.txt
Created April 3, 2017 19:33
Mac OS Sierra 10.12 man page for `stat(2)`
STAT(2) BSD System Calls Manual STAT(2)
NAME
fstat, fstat64, lstat, lstat64, stat, stat64, fstatat -- get file status
SYNOPSIS
#include <sys/stat.h>
int
fstat(int fildes, struct stat *buf);
@Birch-san
Birch-san / httpd.conf
Created June 28, 2017 22:02
Default `/etc/apache2/httpd.conf` provided with Alpine Apache (`apk add apache2`)
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@Birch-san
Birch-san / gist:7f3c8d4fe5cf3feea704b170e8b16298
Created April 16, 2018 21:49
Blocked on mutex inside AudioObjectGetPropertyDataSize (CoreAudio.framework, AudioHardware.h)
__psynch_mutexwait 0x00007fff55a07d1e
_pthread_mutex_lock_wait 0x00007fff55b43bfe
_pthread_mutex_lock_slow 0x00007fff55b41551
HALB_Mutex::Lock() 0x00007fff2da9c91f
HALC_ProxyIOContext::GetPropertyDataSize(AudioObjectPropertyAddress const&, unsigned int, void const*, unsigned int&) const 0x00007fff2dab9fe1
HALC_ShellObject::GetPropertyDataSize(unsigned int, AudioObjectPropertyAddress const&, unsigned int, void const*, unsigned int&) const 0x00007fff2dacecc8
HAL_HardwarePlugIn_ObjectGetPropertyDataSize(AudioHardwarePlugInInterface**, unsigned int, AudioObjectPropertyAddress const*, unsigned int, void const*, unsigned int*) 0x00007fff2dace4bf
HALPlugIn::ObjectGetPropertyDataSize(HALObject const&, AudioObjectPropertyAddress const&, unsigned int, void const*) const 0x00007fff2dace22c
AudioObjectGetPropertyDataSize 0x00007fff2dac9fb1
get_num_outputs 0x000000011c065584