Skip to content

Instantly share code, notes, and snippets.

@andis
andis / add_apt_repo.rb
Last active August 29, 2015 14:21
Add apt repos for use with wright (WIP)
# Add an apt repo from wright scripts.
#
# Example:
#
# AddAptRepo.new(
# self,
# name: 'docker',
# key_id: '36A1D7869245C8950F966E92D8576A8BA88D21E9',
# raw_line: "deb https://get.docker.com/ubuntu docker main"
# ).call
@andis
andis / extract-region-to-file.el
Last active December 18, 2015 16:29
Create a new file from the current region.
(defun extract-region-to-file (filename)
"Extract text in the region to a file"
(interactive "FExtract to file: ")
(save-excursion
(if buffer-read-only
(copy-region-as-kill (region-beginning) (region-end))
(kill-region (region-beginning) (region-end)))
(find-file filename)
(end-of-buffer)
(unless (= (buffer-size) 0)
@andis
andis / gist:1194501
Created September 5, 2011 09:05
Sandwich STDIN and ARGV
#Setup:
git pull git://github.com/sometimesfood/sandwich.git
cd sandwich
rake gem:build
bundle install --path=vendor/bundle
#These work:
echo 'file "/tmp/blubb" do content "blubb";end'|bundle exec sandwich
echo 'file "/tmp/blubb" do content ARGV.join;end'|bundle exec sandwich /dev/stdin bla blubb
@andis
andis / darkice.sh
Created May 10, 2011 16:27
compile an mp3/alsa-enabled darkice in the current directory
#!/bin/bash
wd=$PWD
pf="$wd/local"
get () {
local url=$1
local md5=$2
local name=$3
[ "$(md5sum $name)" = "$md5 $name" ] || curl -L $url -o $name