Skip to content

Instantly share code, notes, and snippets.

View mkhl's full-sized avatar
🖤
…at any cost

Martin Kühl mkhl

🖤
…at any cost
View GitHub Profile
@mkhl
mkhl / any2mp3
Created February 22, 2011 17:43
Convert media files to MP3 using ffmpeg and lame. With automatic tagging.
#!/usr/bin/env ruby
require 'tempfile'
opts = Hash[*%w[--tt title
--ta artist
--tl album
--ty year
--tc comment
@mkhl
mkhl / path_helper.patch
Created June 4, 2009 08:53
Patch to `/usr/libexec/path_helper` to prevent hangs with long `PATH`s
Patch to `/usr/libexec/path_helper` to prevent hangs with long `PATH`s.
--- path_helper_bak 2009-05-07 15:54:37.000000000 +0200
+++ path_helper 2009-06-04 10:51:39.000000000 +0200
@@ -15,7 +15,7 @@
for f in "$DIR" "$DIR".d/* ; do
if [ -f "$f" ]; then
for p in $(< "$f") ; do
- [[ "$NEWPATH" = *(*:)${p}*(:*) ]] && continue
+ egrep -q "(^|${SEP})${p}($|${SEP})" <<<"$NEWPATH" && continue
[ ! -z "$NEWPATH" ] && SEP=":"
@mkhl
mkhl / drop-to-irb.rb
Created December 8, 2008 18:25
Collection of IRB tricks
require 'irb'
module IRB
def self.start_session(binding)
IRB.setup(nil)
workspace = WorkSpace.new(binding)
if @CONF[:SCRIPT]
irb = Irb.new(workspace, @CONF[:SCRIPT])
#!/bin/zsh
# Usage: realpath [<path>...]
# Print each real absolute <path>, resolving symlinks
# Defaults: <path>: read from stdin
case $# in
0)
while read path; do
echo "${path:A}"
done
@mkhl
mkhl / docbook-register
Created July 3, 2010 12:05
Register Homebrew-installed DocBook on Mac OS X
#!/bin/bash
# Bail out if anything goes wrong
set -e
# Make sure Homebrew and DocBook are present
which -s brew
docbook="$(brew --prefix docbook)"
test -d "$docbook"
@mkhl
mkhl / README.md
Created May 16, 2018 10:35
Acme auto commands - like acmego, but generic

Keybase proof

I hereby claim:

  • I am mkhl on github.
  • I am mkhl (https://keybase.io/mkhl) on keybase.
  • I have a public key ASDOZDDY2WKJiu0GMeVXecOv_KalOkFnJhahWX-vYhWcAAo

To claim this, I am signing this object:

# prevent the use of `` in tests
Spec::Runner.configure do |configuration|
backtick = nil # establish the variable in this scope
saved_system = nil
configuration.prepend_before(:all) do
# raise an exception if Kernel#` or Kernel#system is used
# in our tests, we want to ensure we're fully self-contained
Kernel.instance_eval do
backtick = instance_method(:'`')
saved_system = instance_method(:system)
@mkhl
mkhl / README.md
Last active January 16, 2018 08:29

The specific profile doesn’t actually matter!

Take any dark profile (both Pastel and Tango are great!) and change the background to #292929 (the colour of the dark iTerm title bar). I also like to activate Cursor Guide and use a translucent greyish colour.

iTerm Settings

@mkhl
mkhl / README.md
Last active November 2, 2017 10:42 — forked from FND/README.md
complate-wsgi sandbox
$ python3 -m venv venv
$ . venv/bin/activate

$ pip install js2py gunicorn

$ gunicorn app:app

http://localhost:8000