Skip to content

Instantly share code, notes, and snippets.

View ajdiaz's full-sized avatar
⚙️
tweaking things…

ajdiaz ajdiaz

⚙️
tweaking things…
View GitHub Profile
@ajdiaz
ajdiaz / aegis2otp.py
Created April 17, 2021 10:38
Python script which convert plain text backup from Aegis OTP to andOTP
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 Andrés J. Díaz <ajdiaz@ajdiaz.me>
#
# Distributed under terms of the MIT license.
import sys
import time
@ajdiaz
ajdiaz / keybase.md
Last active March 12, 2017 07:26
keybase proof

Keybase proof

I hereby claim:

  • I am ajdiaz on github.
  • I am ajdiaz (https://keybase.io/ajdiaz) on keybase.
  • I have a public key whose fingerprint is 90AD F27A 6AA5 5A78 9738 CDB1 5369 AA41 71B5 139C

To claim this, I am signing this object:

@ajdiaz
ajdiaz / processpool.py
Created January 23, 2013 11:31
Python ProcessPool
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
# vim:fenc=utf-8:
import time
from collections import deque
from threading import RLock, Timer
from multiprocessing import Process, Queue
@ajdiaz
ajdiaz / post.py
Created October 17, 2012 07:21
Python standalone script to post message in identi.ca
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
# vim:fenc=utf-8:
import urllib, urllib2, json, sys, os
import getpass
config_file = os.path.join(os.environ["HOME"],".postrc")
try:
cfg_parser ()
{
IFS=$'\n' && ini=( $(<$1) ) # convert to line-array
ini=( ${ini[*]//;*/} ) # remove comments with ;
ini=( ${ini[*]/\ =/=} ) # remove tabs before =
ini=( ${ini[*]/=\ /=} ) # remove tabs be =
ini=( ${ini[*]/\ =\ /=} ) # remove anything with a space around =
ini=( ${ini[*]/#[/\}$'\n'cfg.section.} ) # set section prefix
ini=( ${ini[*]/%]/ \(} ) # convert text2function (1)
ini=( ${ini[*]/=/=\( } ) # convert item to array
@ajdiaz
ajdiaz / git post-commit hook to dot files.
Created November 3, 2010 10:38
git post-commit hook to dot files.
#! /bin/bash
# (c) 2010 Andres J. Diaz <ajdiaz@connectical.com>
# Modified 2011 by Ryan Turner <rjturner@cmu.edu>
# A hook to git-commit(1) to update the home dot files link using this
# repository as based.
#
# To enable this hook, rename this file to "post-commit".
for dot in $PWD/*; do
home_dot="$HOME/.${dot##*/}"
@ajdiaz
ajdiaz / python-uschedule.py
Created October 2, 2010 14:28
python snippet to handle uschedule jobs
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
Python uschedule handler
------------------------
This module provide a methods to handle uschedule_ scheduler by Uwe Ohse,
which is similar to cron, but safer. Here is an usage example::
@ajdiaz
ajdiaz / python-supervise.py
Created October 2, 2010 14:23
python snippet to handle runit/daemontools services
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
Python supervise
----------------
This module provide a methods to handle runit [1]_ or daemontools [2]_ based
supervised services, using the control file provided. Here are a small
example::