Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# chromium-clean
#
# Clean chromium profile
dir=$(mktemp -d)
/usr/bin/chromium --user-data-dir=$dir "$@"
rm -rf $dir
import sys
print('\n'.join(' '.join(col) for col in zip(*reversed([line.split(' ') for line in sys.stdin.read().rstrip().split('\n')]))))
@darkfeline
darkfeline / search.py
Created January 29, 2016 06:47
AniDB XML title dump searcher
"""Search against AniDB titles dump.
"""
import argparse
import xml.etree.ElementTree as ET
import pickle
import os
import re
#!/usr/bin/python3
"""
ytplay
======
Play a list of youtube songs from stdin, echoing to stdout.
"""
@darkfeline
darkfeline / star.lisp
Created December 16, 2015 01:19
Print star
(defun star (input)
"Make star."
(let* ((l (length input))
(lo (- l 1))
(ll (- (* 2 l) 1))
(star (make-array (list ll ll) :initial-element #\Space)))
(dotimes (i l)
(let ((a (+ 0 i))
(b (- ll i 1)))
(map nil (lambda (x y) (setf (aref star x y) (aref input i)))
@darkfeline
darkfeline / star.py
Last active November 11, 2016 09:33
Print star (Python one line)
#!/usr/bin/env python3
(lambda sys:(lambda input:(lambda ilen:(lambda m,olen:(lambda star:(lambda f,g:None)(list(map(lambda i:(lambda b:list(map(lambda x,y: star[x].__setitem__(y,input[i]),[i,b,m,m,i,i,b,b],[m,m,i,b,i,b,i,b])))(olen-i-1),range(ilen))),print("\n".join("".join(char for char in row) for row in star))))([[" " for x in range(olen)] for x in range(olen)]))(ilen-1,2*ilen-1))(len(input)))(sys.argv[1]))(__import__('sys'))
@darkfeline
darkfeline / use-package-delight.el
Last active August 29, 2015 14:17
Delight plugin for use-package.el
(use-package delight)
(add-to-list 'use-package-keywords :delight t)
(defun use-package-normalize/:delight (name-symbol keyword args)
"Normalize arguments to delight."
(cond
((and (= (length args) 1)
(symbolp (car args)))
(list (car args) nil name-symbol))
@darkfeline
darkfeline / multimethods.py
Last active August 29, 2015 14:08
Python multimethods (Clojure style)
class MultiMethod:
def __init__(self, func):
self.func = func
self.methods = {}
def __call__(self, *args, **kwargs):
return self.methods[self.func(*args, **kwargs)](*args, **kwargs)
def method(self, case):
<br />
<h1>Heading one</h1>
<h2>Header two</h2>
<h3>Header three</h3>
<h4>Header four</h4>
<h5>Header five</h5>
<h6>Header six</h6>
<p>This is a copy of one of the sample pages from the <a href="http://www.wordpress.org" onclick="_gaq.push(['_trackEvent', 'outbound-article', 'http://www.wordpress.org', 'WordPress']);" >WordPress</a> theme development test content. I found it handy to keep a copy of this for building sites that aren’t using WordPress. 99% of the credit goes to them, I’m just hosting it in a handy place in case it’s useful to anyone other than me.</p>
<h2>Blockquote Tests</h2>
<p>Blockquote:</p>
@darkfeline
darkfeline / switch.py
Created June 1, 2014 03:46
Python switch-case
class SwitchCase:
"""
Simple implementation of switch-case statements in Pythonic style.
>>> switch = SwitchCase()
Adding case handlers:
>>> @switch.case('foo')