Skip to content

Instantly share code, notes, and snippets.

JonasPf

Block or report user

Report or block JonasPf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:77fe919c5e146628638c55cf7506bffc
### 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:
View gist:216a9b8457a16d472664093492081300
Verifying my Blockstack ID is secured with the address 1GPb42kqRpLpUDG2kAtwzRXDsjFYVmTtGN https://explorer.blockstack.org/address/1GPb42kqRpLpUDG2kAtwzRXDsjFYVmTtGN
View use_ansible.py
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 Feb 8, 2017
Bitcoin hex address to base58check
View hex2base58check.py
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 Mar 22, 2016
List openstack freezer backups with datetime and size
View list_backups.py
import subprocess
import datetime
import re
import sys
backups = subprocess.check_output(['swift', 'list', sys.argv[1]]).splitlines()
width = None
total = 0
@JonasPf
JonasPf / writebmp.py
Created Jul 15, 2014
wxPython: Create and save bitmap
View writebmp.py
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 Jul 14, 2014
Custom wxPython control
View customcontrol.py
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)
@JonasPf
JonasPf / gist:9461819
Last active Aug 29, 2015
Create distinct colours
View gist:9461819
#
# Creates a html page with a list of distinct looking colours for graphs, etc.
# Algorithm from: http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
#
# Jonas Pfannschmidt
from colorsys import hsv_to_rgb
golden_ratio_conjugate = 0.618033988749895
@JonasPf
JonasPf / automate.py
Created Apr 9, 2013
Collection of functions and classes I use to automate console applications. Tested on Python 2.7 and Windows 7.
View automate.py
import os
import re
import sys
import zipfile
import shutil
import subprocess
import time
import threading
import Queue
You can’t perform that action at this time.