Skip to content

Instantly share code, notes, and snippets.

View wosc's full-sized avatar

Wolfgang Schnerring wosc

View GitHub Profile

Keybase proof

I hereby claim:

  • I am wosc on github.
  • I am wosc (https://keybase.io/wosc) on keybase.
  • I have a public key whose fingerprint is D062 178B 7F40 C78F 7724 24CE 61F5 821D E73B C3B4

To claim this, I am signing this object:

@wosc
wosc / slack-readline.user.js
Created February 18, 2015 20:00
Greasmonkey User Script for Slack: Restore Readline Keybindings
// ==UserScript==
// @name Slack: Restore Readline Keybindings
// @namespace http://wosc.de/
// @version 1.0
// @description Don't let Slack capture keybindings for C-u and C-k (use C-o to open omnibox instead)
// @author Wolfgang Schnerring <wosc@wosc.de>
// @match https://*.slack.com/*
// @grant none
// ==/UserScript==
#!/bin/bash
ARGS="$@"
case "$1" in
ci)
shift
DIFF=$(svn diff "$@" | grep --context 5 pdb.set_trace)
if [ -n "$DIFF" ]; then
echo "$DIFF"
read -ep "Continue (y/N): " OK
@wosc
wosc / .pdbrc
Created September 4, 2012 14:58
pdb persistent history
import os
execfile(os.path.expanduser("~/.pdbrc.py"))
/* Will no-one*/ } catch( Exception e /* ! */ ) {
//No getMessage() shall we ever see,
//No System.exit( THIS_SHOULD_NOT_BE );
//No RuntimeException( WONT_CATCH_ME );
//No closure for Exception e,
//for our programmer, with little thought,
//has left Exception e uncaught!
} //Oh cruel bracket, how you limit the scope of his instance!
def alias(column_name):
"""returns a descriptor that is usable everywhere the original column name
was: (not really a doctest, sorry)
>>> class Foo(SQLBase):
... original = Column(Integer)
... new = alias('original')
>>> foo = Foo()
>>> foo.new = 5
@wosc
wosc / routing.yml
Created July 14, 2016 09:04
Enable basic auth for wallbag export by adding these configuration statements (files are in app/config/)
backup:
path: "/backup/{category}.{format}"
defaults:
_controller: WallabagCoreBundle:Export:downloadEntries
requirements:
category: all|unread|starred|archive
format: epub|mobi|pdf|json|xml|txt|csv
#!/usr/bin/env python
import json
import sys
# See https://msdn.microsoft.com/en-us/library/aa753582%28VS.85%29.aspx
# and https://github.com/shaarli/Shaarli/blob/v0.6.5/index.php#L1899
HEADER = u'<!DOCTYPE NETSCAPE-Bookmark-file-1><DL>'
FOOTER = u'</DL>'
ITEM = u'<DT><A HREF="{url}" ADD_DATE="{time_created}" TAGS="{tags}">{title}</A>'
@wosc
wosc / backup-delicious.py
Created April 13, 2016 17:40
Backup all your delicious.com bookmarks by scraping the UI-facing API
import json
import requests
import sys
BASE_URL = 'https://avosapi.delicious.com/api/v1/posts/you/time'
def get_bookmarks(entry, auth):
if not entry:
r = requests.get(BASE_URL, auth=auth)
@wosc
wosc / backup-shaarli.sh
Created March 29, 2018 12:01
Automated export of bookmarks from Shaarli
#!/bin/bash
# Export bookmarks from Shaarli <https://github.com/shaarli/Shaarli> in Netscape HTML format.
# Adapted from <https://github.com/nodiscc/shaarchiver>
url=$1
user=$2
pass=$3
cookies=$(mktemp)
curl="curl -s --cookie-jar $cookies --cookie $cookies"