Skip to content

Instantly share code, notes, and snippets.

View joejulian's full-sized avatar
🕶️
working without pants.

Joe Julian joejulian

🕶️
working without pants.
View GitHub Profile
def char8(uuid):
allowed = 'abcdefghijkmnopqrstuvwxyz1234567890' * 5
b = ""
a = uuid.hex
while a:
b += allowed[int(a[:2],16) & 0xaf]
a = a[4:]
return b
jjulian at questor in /tmp/foo.mnt
$ df -h .
Filesystem Size Used Avail Use% Mounted on
none 16G 0 16G 0% /tmp/foo.mnt
jjulian at questor in /tmp/foo.mnt
$ truncate --size=5G fubar
jjulian at questor in /tmp/foo.mnt
$ ls -l fubar
@joejulian
joejulian / USBMount.scad
Created May 24, 2016 05:39
Mounting cage for amazon powered 4 port hub (ver 0.90)
module roundedRect(size, radius) {
x = size[0];
y = size[1];
z = size[2];
linear_extrude(height=z)
hull() {
// place 4 circles in the corners,
// with the given radius
translate([

Keybase proof

I hereby claim:

  • I am joejulian on github.
  • I am joejulian (https://keybase.io/joejulian) on keybase.
  • I have a public key whose fingerprint is B53B AA8F 721A A93F 8499 2C8B 9747 CCED 3D05 49EC

To claim this, I am signing this object:

@joejulian
joejulian / rgbtohsv.groovy
Last active September 8, 2016 06:31
Groovy source for rgb to hsv conversion since groovy doesn't have a properly working modulo operator.
def rgbToHSV(red, green, blue) {
float r = red / 255f
float g = green / 255f
float b = blue / 255f
float max = [r, g, b].max()
float min = [r, g, b].min()
float delta = max - min
def hue = 0
def saturation = 0
if (max == min) {
@joejulian
joejulian / 10_restart.conf
Created September 12, 2016 20:35
Make glusterd restart continuously if it fails: /etc/systemd/system/glusterd.service.d/10_restart.conf
[Service]
RestartSec=3
Restart=always
@joejulian
joejulian / resize_part
Last active December 26, 2016 07:04
Python utility to maximize the root partition of a vm image for cloud-init
#! /opt/pyparted/bin/python
import parted
import os
import sys
import dbus
def ask_udisk2(mountpath):
bus = dbus.SystemBus()
udisks2obj = bus.get_object('org.freedesktop.UDisks2', '/org/freedesktop/UDisks2')
---
deployment:
cluster:
- name: joej
network: 10.32.0.0/12
dns: 10.32.0.2
domain: cluster.local
provider: ['aws']
repos:
- name: atlas
from time import sleep
import traceback
import sys
def sleepex(data):
delay=1.25 # seconds
attempt=1
if 'delay' in data.keys():
delay=data['delay']
print(delay)
from time import sleep
import sys
def sleepex(data):
# Set some defaults in case this filter is called without
# being in a loop
delay=1.25 # seconds
attempt=1
if 'delay' in data.keys():