Skip to content

Instantly share code, notes, and snippets.

View Gumnos's full-sized avatar

Tim Chase Gumnos

  • outside Dallas, TX
View GitHub Profile
@Gumnos
Gumnos / rcs2git
Created February 12, 2012 03:51 — forked from thwarted/rcs2git
rcs2git, quick and dirty brute force
#!/bin/bash
email_domain=example.com
export email_domain
# so nothing in the environment comes through
unset GIT_AUTHOR_EMAIL
unset GIT_AUTHOR_DATE
unset GIT_AUTHOR_NAME
unset GIT_COMMITTER_NAME
@Gumnos
Gumnos / passphrasegen.py
Last active June 6, 2021 00:49
Generate a pass-phrase like "correct horse battery staple" from a dictionary of words
#!/usr/bin/env python
import locale
import random
import re
import sys
from codecs import encode
from copy import copy
from optparse import OptionParser
EXIT_SUCCESS = 0
@Gumnos
Gumnos / color_py.sed
Last active February 20, 2016 03:47
A rough attempt at making a Python syntax colorizer in sed
#!/bin/sed -f
# operators
#s/\<\(in\|is\)\>\|[][{}():.*\/+-]/\x1b[30;1m&\x1b[0m/g
s/\<\(in\|is\)\>/\x1b[32;1m&\x1b[0m/g
# booleans
s/\<\(and\|not\|or\)\>/\x1b[32m&\x1b[0m/g
# strings
@Gumnos
Gumnos / nixcraft.cow
Created December 25, 2017 20:07
Cowsay file using the @nixcraft logo
$nixcraft_eyes = substr $eyes, 1, 1;
$the_cow = <<EOC;
$thoughts
$thoughts, - ~ ~ ~ - ,
, ' ' ,
, ,__. ,
, /~### ~\\ ,
, |##( $nixcraft_eyes > ,
, |###\\ $tongue ,
, \\##| \\ ,
@Gumnos
Gumnos / encrypted-git-repo.md
Created January 10, 2019 03:15
Transparent Git Encryption

Transparent Git Encryption

This document has been modified from its [original format][m1], which was written by Ning Shang ([email protected]). It has been updated and reformatted into a [Markdown][m2] document by [Woody Gilk][m3] and [republished][m4].

Description

When working with a remote git repository which is hosted on a third-party storage server, data confidentiality sometimes becomes

@Gumnos
Gumnos / deconstructed_words.py
Last active January 18, 2019 21:40
Find words in a dictionary that can be deconstructed one letter at a time while still making words from that dictionary
from sys import argv
from string import ascii_lowercase
lowercase = frozenset(ascii_lowercase)
if len(argv) > 1:
dictionary_name = argv[1]
else:
dictionary_name = "/usr/share/dict/words"
dictionary = frozenset(
@Gumnos
Gumnos / dexter_if_exists.c
Created January 4, 2022 15:47
A short C program to determine if one or more network interfaces exist on FreeBSD
# compile with `cc -o if_exists dexter_if_exists.c`
#include <stdio.h>
#include <sysexits.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
int
main(int argc, char *argv[]) {
@Gumnos
Gumnos / missing_interfaces.c
Created January 5, 2022 12:33
Given a list of network interfaces, report back which interfaces are missing
#include <stdio.h>
#include <sysexits.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
int
main(int argc, char *argv[]) {
int i;
int result;
@Gumnos
Gumnos / bs.py
Created February 10, 2022 01:17
Bookstore simulator
from random import randint
def d6():
return randint(1,6)
day = money = 0
time = patience = 10
while day < 10 and money < 10:
day += 1
@Gumnos
Gumnos / reuuid.awk
Last active June 30, 2022 18:25
Find UUIDs in input (stdin or files) and replace them with new UUIDs
#!/usr/bin/awk -f
function uuid(_c, _r) {
_c = "uuidgen"
_c | getline _r
close(_c)
return _r
}
BEGIN {
r = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{8}"