Skip to content

Instantly share code, notes, and snippets.

@marcells
marcells / pulseaudio-switch.sh
Created September 2, 2016 11:42
Switches to a different pulseaudio source. Helpful, if you want to switch between a headset/speaker with a shortcut command.
#!/bin/bash
# List sinks with 'pacmd list-sink-inputs'
OUTPUTS[0]="alsa_output.pci-0000_00_1b.0.analog-stereo"
OUTPUTS[1]="bluez_sink.A0_E9_DB_01_A9_71"
OUTPUT=${OUTPUTS[$1]}
pacmd set-default-sink $OUTPUT >/dev/null 2>&1
@marcells
marcells / md_stats.sh
Created March 10, 2015 00:28
Shell script, which groups the words of a markdown file by their number of usage
#!/bin/sh
pandoc -f markdown -t plain "$1" | tr "[:punct:][:space:]" "\n" | sort | uniq -c | sort -n
[alias]
co = checkout
ci = commit
st = status
br = branch
type = 'cat-file -t'
dump = 'cat-file -p'
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
ac = !git add -A && git commit
@marcells
marcells / migrate_hg_to_git.sh
Created July 31, 2013 23:02
This small bash script migrates all the given bitbucket mercurial repositories to git (the remote repositories are created automatically). Prerequisites: hg, http://hg-git.github.io and curl
#!/bin/bash
# General settings
username="bitbucket username"
password="bitbucket password"
tmp_local_repo_path=/tmp/bb_migration
# Define repository mappings: repos["hg_repo_name"]="new_git_repo_name"
declare -A repos
#repos["hg_repo_1"]="new_git_repo_1"
@marcells
marcells / gist:5810096
Created June 18, 2013 22:33
Execute dyndnslogin bash script from windows command promt. (Script: https://github.com/mindfuckup/Scripts/blob/master/dyndnslogin)
@echo off
SET CYGWIN_BASH=D:\cygwin\bin\bash.exe
SET DYNDNS_SHELLSCRIPT_PATH=c:/path/to/dyndnslogin.sh
%CYGWIN_BASH% --login -c '%DYNDNS_SHELLSCRIPT_PATH%'
REM You can also use optional arguments (if the script is modified)
REM %CYGWIN_BASH% --login -c '%DYNDNS_SHELLSCRIPT_PATH% username password'
@marcells
marcells / AutoHotkey.ahk
Last active December 16, 2015 20:09
Wanna improve your shortcut skills? Just download http://www.autohotkey.com/ and use this script to disable your mouse in your favorite IDE!
; Disable Mouse in Visual Studio and Sublime
; © Marcell Spies (@marcells)
SetTitleMatchMode 2
GroupAdd WindowsToDeactivateMouse, Microsoft Visual Studio
GroupAdd WindowsToDeactivateMouse, Sublime
#IfWinActive ahk_group WindowsToDeactivateMouse
NoMouseAvailable()
{
@marcells
marcells / edit.cmd
Created December 4, 2012 22:25
Wrapper to run sublime from command prompt
REM *******************************************************************
REM If you don't want to pollute your PATH variable, just copy this
REM script to your %windir% or path with your commandline tools.
REM *******************************************************************
@echo off
SET SUBLIME_PATH=Sublime Text 2\sublime_text.exe
IF EXIST "%PROGRAMFILES%\%SUBLIME_PATH%" GOTO RUN_SUBLIME