Skip to content

Instantly share code, notes, and snippets.

@mjtorn
mjtorn / vcf_to_jolla.py
Created December 21, 2013 19:53
To push tons of VCF files over MTP
#!/usr/bin/env python
# vim: fileencoding=utf-8
# vcf_to_jolla.py
import glob
import pymtp
import os
import sys
DST_NAME = 'Documents/Contacts'
@mjtorn
mjtorn / xorg_build-0.5.sh
Created January 11, 2014 15:36
How to build Xorg unintrusively. Works on Debian Sid with xdm. At the time of posting this, at least.
#!/bin/bash
## Thank you for helping us help you help us all
SRCDIR=/usr/src/tmpfs/xorg
DSTDIR=/opt/xorg
## Define what's cloned
REPOS="\
git://anongit.freedesktop.org/git/xorg/util/macros \
@mjtorn
mjtorn / psqlrc
Last active November 9, 2015 11:09
\pset null 'NULL'
\set PROMPT1 '%n@%m %/%R%x%# '
\set PROMPT2 '%n@%m %/%R%x%# '
\set AUTOCOMMIT off
\set ON_ERROR_ROLLBACK interactive
\encoding UNICODE
\timing
\x auto
---
@mjtorn
mjtorn / email_combo_backend.py
Created March 21, 2014 08:51
email_combo_backend.py
# vim: fileencoding=utf-8
from django.core.mail.backends.base import BaseEmailBackend
from django.core.mail import get_connection
from django.conf import settings
import logging
logger = logging.getLogger('django')
@mjtorn
mjtorn / config_flake8
Last active January 18, 2017 03:40
Using pylint with Syntastic for Vim makes it really slow. flake8 seems to catch the most relevant errors, but I like to disable some of them.
# Accually is ~/.config/flake8
[flake8]
max-line-length = 120
# E265: The one about comments starting '# '
# E127,E128: Errors about inline alignment
# W391: blank line at EOF. Of course you want a blank line there.
# F403: from foo import * is sometimes too useful$
ignore = E265,E127,E128,W391,F403
@mjtorn
mjtorn / gitconfig
Last active January 14, 2016 16:26
~/.gitconfig
[alias]
lg = log --graph --pretty=format:\"%Cred%h%Creset – %s %Cgreen(%cr)%Creset\" --abbrev-commit --date=relative
vomit = commit
grepn = grep -n
stat = status --untracked-files=no
history = log --reverse
hist = log --reverse
chist = log --reverse --color -U3
clog = log --color -U3
flog = log --numstat
@mjtorn
mjtorn / ghmigrate.sh
Created September 19, 2014 09:56
In the event you need to migrate repos from GitHub
#!/usr/bin/env bash
# Conf section
GH_USER=USER
DEST_USER=gitolite
DEST_HOST=example.com
TMPDIR=${HOME}/tmp/gitmigration
mkdir -p $TMPDIR
@mjtorn
mjtorn / local.yml
Created December 7, 2014 19:30
To run TextSecure-Server easily
twilio:
accountId:
accountToken:
number:
localDomain: # The domain Twilio can call back to.
international: # Boolean specifying Twilio for international delivery
# Optional. If specified, Nexmo will be used for non-US SMS and
# voice verification if twilio.international is false. Otherwise,
# Nexmo, if specified, Nexmo will only be used as a fallback
@mjtorn
mjtorn / sailfish-env.sh
Last active March 18, 2021 18:16
If you want to run SailfishOS SDK stuff without QT creator. Feel free to send updates to this, it's very much _not_ a product ;)
#!/usr/bin/env bash
# (c) mjt 2015
# hailz python virtualenvs and http://nckweb.com.ar/sailing-code/2015/01/01/develop-without-qtcreator/
# released under wtfpl
if [ -z ${1:-} ]; then
if [ -z ${IN_MER:-} ]; then
echo "USAGE: source sailfish-env MER_SSH_TARGET_NAME"
echo "EXAMPLE: source sailfish-env SailfishOS-i486"
@mjtorn
mjtorn / orbweaver.usbcap
Created January 2, 2016 05:46
orbweaver-usbmon
ffff880818abd240 757359941 S Ci:7:008:0 s 80 06 0100 0000 0012 18 <
ffff880818abd240 757360446 C Ci:7:008:0 0 18 = 12010002 00000040 32151301 00020102 0001
ffff8808151fd9c0 757360502 S Ci:7:008:0 s 80 06 0200 0000 0009 9 <
ffff8808151fd9c0 757362439 C Ci:7:008:0 0 9 = 09025400 030100a0 fa
ffff8808151fd9c0 757362466 S Ci:7:008:0 s 80 06 0200 0000 0054 84 <
ffff8808151fd9c0 757364443 C Ci:7:008:0 0 84 = 09025400 030100a0 fa090400 00010301 01000921 11010001 223d0007 05810308
ffff8804deb846c0 757365440 C Ii:7:008:1 -108:1 0
ffff88080f8a09c0 757396446 C Ii:7:008:2 -108:1 0
ffff880817c9f600 757419444 C Ii:7:008:3 -108:1 0
ffff880818abd000 757589545 S Ci:7:008:0 s 80 06 0100 0000 0040 64 <