Skip to content

Instantly share code, notes, and snippets.

View djui's full-sized avatar

Uwe Dauernheim djui

View GitHub Profile
@djui
djui / ibooks-export.py
Last active February 17, 2022 05:51
Simple iBooks book index export script
#!/usr/bin/env python3
import os
import plistlib
import sys
from datetime import datetime
def main(args):
books_path = '~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books/Books.plist'
@djui
djui / goodreads-export.py
Created October 6, 2015 14:43
Simple script to export Goodreads exports
#!/usr/bin/env python3
import csv
import sys
def main(args):
if not args:
return 'Usage: goodreads-export FILE'
@djui
djui / DSF.md
Last active October 9, 2015 12:34
Delay-Sensitivity Framework (DSF)
❯ ll
total 937M
-rw-r--r-- 1 uwe staff 8.8K Nov 20 23:38 CoreOS_Image_Signing_Key.asc
-rw-r--r-- 1 uwe staff 332 Nov 23 22:55 Dockerfile
-rw-r--r-- 1 uwe staff 3.7K Nov 23 22:35 Makefile
-rw-r--r-- 1 uwe staff 3.3K Nov 20 23:19 README.md
-rwxr-xr-x 1 uwe staff 2.1K Nov 23 23:05 build_ova.sh
-rwxr-xr-x 1 uwe staff 433 Nov 20 23:36 build_pdftables.com-ee.sh
-rw-r--r-- 1 uwe staff 496M Nov 23 22:30 coreos_production_vmware_image.vmdk
-rw-r--r-- 1 uwe staff 543 Nov 23 22:30 coreos_production_vmware_image.vmdk.bz2.sig
@djui
djui / readln.go
Created December 2, 2015 10:08
Minimal readline with timeout example
import (
"bufio"
"errors"
"strings"
"time"
)
// Readln reads and returns a single line (sentinal: \n) from stdin.
// If a given timeout has passed, an error is returned.
// This functionality is similar to GNU's `read -e -p [s] -t [num] [name]`
@djui
djui / go-funclen
Last active February 17, 2016 17:17
Print a list of all most-outer scope Go functions sorted by their length.
#!/usr/bin/env python3
import glob
import json
import sys
def main(args):
if not args:
print("Usage: go-funclen BASEDIR", file=sys.stderr)
@djui
djui / s3_foreach.go
Last active March 2, 2016 16:40
Takes a list of S3 URLs and applies a function on each file
package main
import (
"bufio"
"fmt"
"io/ioutil"
"net/url"
"os"
"strings"
"sync"
@djui
djui / go-test-pretty
Created March 23, 2016 14:41
Highlights the go test output
#!/bin/bash
sed ''/RUN/s//$(printf "\033[30;1mRUN\033[0m")/'' | \
sed ''/PASS:/s//$(printf "\033[32mPASS\033[0m:")/'' | \
sed ''/PASS/s//$(printf "\033[32;1mPASS\033[0m")/'' | \
sed ''/SKIP:/s//$(printf "\033[33mSKIP\033[0m:")/'' | \
sed ''/SKIP/s//$(printf "\033[33;1mSKIP\033[0m")/'' | \
sed ''/FAIL:/s//$(printf "\033[31mFAIL\033[0m:")/'' | \
sed ''/FAIL/s//$(printf "\033[31;1mFAIL\033[0m")/''
$ pwd
/Users/uwe/dev/inception-test
$ touch hello_inception
$ docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/foo docker
/ # ls /foo/hello_inception
/foo/hello_inception
/ # cd /foo
/foo # docker run --rm -it -v $(pwd):/foo docker
@djui
djui / PushEvent.go
Last active May 25, 2016 08:03
go-github push event handling
github.PushEvent{
Repo:github.PushEventRepository{
CreatedAt:github.Timestamp{2015-10-26 15:42:55 +0000 UTC},
DefaultBranch:"master",
Description:"A simple continuous integration server using Hookbot to subscribe to branch changes on Github hosted repositories.",
Fork:false,
ForksCount:0,
FullName:"scraperwiki/seaeye",
HasDownloads:true,
HasIssues:true,