Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am jonaspf on github.
* I am jonaspf (https://keybase.io/jonaspf) on keybase.
* I have a public key ASCr5nrf_TjnIu2pM823Scn45eCMa450-69e9rT5Od9BRQo
To claim this, I am signing this object:
Verifying my Blockstack ID is secured with the address 1GPb42kqRpLpUDG2kAtwzRXDsjFYVmTtGN https://explorer.blockstack.org/address/1GPb42kqRpLpUDG2kAtwzRXDsjFYVmTtGN
import json
import subprocess
import os
from collections import namedtuple
from tempfile import NamedTemporaryFile
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
from ansible.inventory import Inventory
from ansible.playbook.play import Play
@JonasPf
JonasPf / hex2base58check.py
Created February 8, 2017 20:57
Bitcoin hex address to base58check
import binascii
import base58
import sys
string = sys.argv[1]
hex_values = binascii.unhexlify(string)
print(base58.b58encode_check(hex_values))
@JonasPf
JonasPf / list_backups.py
Created March 22, 2016 13:51
List openstack freezer backups with datetime and size
import subprocess
import datetime
import re
import sys
backups = subprocess.check_output(['swift', 'list', sys.argv[1]]).splitlines()
width = None
total = 0
@JonasPf
JonasPf / automate.py
Created April 9, 2013 20:29
Collection of functions and classes I use to automate console applications. Tested on Python 2.7 and Windows 7.
import os
import re
import sys
import zipfile
import shutil
import subprocess
import time
import threading
import Queue
@JonasPf
JonasPf / menus.py
Created April 8, 2013 20:15
A few simple methods to create interactive console applications with menus, prompts for text, date, boolean etc.
"""
menus.py
Version: 0.5
A few simple methods to create interactive console applications. See the example at the bottom of this file.
Tested on Python 2.7 and Windows 7.
Copyright (c) 2013, Jonas Pfannschmidt
Licensed under the MIT license http://www.opensource.org/licenses/mit-license.php
@JonasPf
JonasPf / writebmp.py
Created July 15, 2014 11:55
wxPython: Create and save bitmap
w = 500
h = 300
bmp = wx.EmptyBitmap(w, h)
dc = wx.MemoryDC()
dc.SelectObject(bmp)
dc.SetBackground(wx.Brush('black'))
dc.Clear()
dc.SetBrush(wx.Brush('green'))
@JonasPf
JonasPf / customcontrol.py
Created July 14, 2014 22:20
Custom wxPython control
import wx
class CustomPanel(wx.PyPanel):
def __init__(self, parent):
wx.PyPanel.__init__(self, parent)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
alert('I am evil');