Skip to content

Instantly share code, notes, and snippets.

Isabell Cowan Izzette

View GitHub Profile
View iloveyou.c
// iloveyou.c
#include <stdio.h>
int main () {
for (unsigned int I = 0; I<3U; ++I)
puts("true == I<3U");
}
// vim: set ts=4 sw=4 noet syn=c:
@Izzette
Izzette / ring_buffer.c
Last active May 26, 2017
Lock-free ring-buffer for single reader/writer without atomic primitives.
View ring_buffer.c
// ring_buffer.c
// ring_buffer -- Trivial lock-free (wait-free) ring-buffer for use in
// single-reader/single-writer scenarios without using atomic primitives.
// Copyright (C) 2017 Isabell Cowan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
@Izzette
Izzette / blockstatd.py
Created Feb 19, 2017
Send Linux block device statistics to graphite
View blockstatd.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# blockstatd.py
# The graphite-blockstat daemon
# graphite-blockstat -- Send Linux blockstat metrics to Graphite
# Copyright (c) 2017 Bodhi Digital LLC., Isabell Cowan
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@Izzette
Izzette / cryptpass.py
Created Feb 19, 2017
Create encrypted Unix password in Python
View cryptpass.py
#!/usr/bin/env python
import string
from random import SystemRandom
from crypt import crypt
from getpass import getpass
def get_salt(saltlen):
copts = string.ascii_letters + string.digits
sysrand = SystemRandom()
@Izzette
Izzette / dhcp_dup_reservations.py
Last active Feb 25, 2017
Clone DHCP reservations to a secondary fallback server using the Foreman DHCP Smart Proxy API
View dhcp_dup_reservations.py
#!/usr/bin/env python3
import json
from urllib.request import Request, urlopen
from sys import argv, stderr
def pp_json(data):
pretty_json = json.dumps(data, sort_keys=True, indent=2, separators=(",", ": "))
@Izzette
Izzette / calc_uptime.sh
Last active Mar 8, 2017
Calculate up time percentage using journalctl
View calc_uptime.sh
#!/bin/bash
function get_stime() {
head -n 2 <<< "$1" | tail -n 1 | cut -d ' ' -f 1-3 | date --date="$(cat /dev/fd/0)" +%s
}
function get_etime() {
tail -n 1 <<< "$1" | cut -d ' ' -f 1-3 | date --date="$(cat /dev/fd/0)" +%s
}
You can’t perform that action at this time.