Skip to content

Instantly share code, notes, and snippets.

@Tatsh
Tatsh / Avery_11528_01.template.xml
Last active August 29, 2015 14:05
Avery 11528 gLabel templates. These go in `~/.config/libglabels/templates/`. Starts from the top (01) to the last. Rename to `.template`.
<?xml version="1.0"?>
<Glabels-templates xmlns="http://glabels.org/xmlns/3.0/">
<Template brand="Avery" part="11528-1" size="US-Letter" description="Avery 11528 first tab (top)">
<Label-rectangle id="0" width="13mm" height="46mm" round="0mm" x_waste="0mm" y_waste="0mm">
<Markup-margin size="1mm"/>
<Layout nx="1" ny="1" x0="198mm" y0="12mm" dx="14mm" dy="51mm"/><!-- 198 = 216 mm - width - margin -->
</Label-rectangle>
</Template>
</Glabels-templates>
@Tatsh
Tatsh / git-unclean.py
Created September 5, 2014 17:38
Recursively find all unclean directories managed by Git.
#!/usr/bin/env python
# Recursively find all unclean directories managed by Git.
from __future__ import print_function
from os import listdir
from os.path import isdir, join as path_join, realpath
import os
from sh import git
git = git.bake('-c', 'color.status=false')
@Tatsh
Tatsh / find-longest.coffee
Last active July 13, 2020 18:12
Part of a coding challenge.
find = (s) ->
coll = [
[s[0], 1],
]
last = s[0]
i = 0
candidate = null
max = s.length - 1
for c in s[1..]
@Tatsh
Tatsh / php-bash-completion.sh
Last active August 29, 2015 14:07
PHP Bash completion
# kate: hl bash
_php() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-a
-c
-n
from datetime import datetime, timedelta
from os import listdir, stat
from os.path import getsize, isdir, join as path_join, realpath
import argparse
import logging
import sys
from Crypto.Random.random import StrongRandom
from osext.filesystem import isfile
@Tatsh
Tatsh / example-as.js
Last active May 16, 2020 07:29
Example AppleScript in JavaScript.
// Send a message to one person by name with Messages.app
function sendMessageTo(name, message) {
var app = Application('Messages');
var chats = app.chats(); // Get all the chats, regardless of service
var theChat;
for (var i = 0, len < chats.length; i < len; i++) {
chat = chats[i];
if (chat.participants().length > 1) { // Ignore 'rooms'
continue;

Keybase proof

I hereby claim:

  • I am tatsh on github.
  • I am tatsh (https://keybase.io/tatsh) on keybase.
  • I have a public key whose fingerprint is 60AF 74F3 88EF 4F49 31C0 8E38 1AFD 9AFC 120C 26DD

To claim this, I am signing this object:

@Tatsh
Tatsh / ngd.user.js
Last active November 25, 2016 06:38
No Google Doodle
// ==UserScript==
// @name GoogleNoDoodle
// @namespace http://tat.sh
// @description Removes the doodle and moves the logo a bit upward.
// @include http://www.google.com
// @include https://www.google.com
// @include http://www.google.com/?complete=0
// @include https://www.google.com/?complete=0
// @downloadURL https://gist.github.com/Tatsh/c2db8e421e0eb982c5dc/raw/ngd.user.js
// @updateURL https://gist.github.com/Tatsh/c2db8e421e0eb982c5dc/raw/ngd.user.js
@Tatsh
Tatsh / isync-ratings.py
Last active October 24, 2020 15:52
Sync ratings from an iTunes database off an iOS device (MediaLibrary.sqlitedb).
#!/usr/bin/env python
import os
import subprocess as sp
import signal
import sqlite3
import sys
from os.path import expanduser
from time import sleep
@Tatsh
Tatsh / cleanup-kernel-src.py
Created April 15, 2015 01:29
Gentoo: Clean up old kernel sources in /usr/src
#!/usr/bin/env python
from os import chdir, listdir
from os.path import basename, islink, realpath
from shutil import rmtree
import re
import subprocess as sp
import sys
if __name__ == '__main__':