Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
wooohoo

Chad Catlett chadcatlett

💭
wooohoo
  • New Relic
  • Somewhere in Texas
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am chadcatlett on github.

  • I am chadcatlett (https://keybase.io/chadcatlett) on keybase.

  • I have a public key ASD6-nNBFBRi4SysHEkJplrPf0zun2lBAvHuaNQVW5Mx3Ao

@chadcatlett
chadcatlett / urldecode.jq
Created Feb 16, 2019
no idea where i found this
View urldecode.jq
def urldecode:
def unhex:
if 48 <= . and . <= 57 then . - 48 elif 65 <= . and . <= 70 then . - 55 else . - 87 end;
def bytes:
def loop($i):
if $i >= length then empty else 16 * (.[$i+1] | unhex) + (.[$i+2] | unhex), loop($i+3) end;
[loop(0)];
def codepoints:
View heh.sh
# Usage: convert os_device
# Convert an OS device to the corresponding GRUB drive.
# This part is OS-specific.
convert () {
# First, check if the device file exists.
if test -e "$1"; then
:
else
echo "$1: Not found or not a block device." 1>&2
exit 1
View klondike.diff
diff --git a/configure.yml b/configure.yml
index 3ee5669..7ade25e 100644
--- a/configure.yml
+++ b/configure.yml
@@ -1,4 +1,4 @@
-- hosts: 127.0.0.1
+- hosts: localhost
connection: local
gather_facts: False
roles:
View gist:5e1577fd86bf5c7553e9
[url "https://github.com/"]
insteadOf = git://github.com/
View stoken-version-script.patch
From 9a5a4343f378cf5dbd35f113e374a50db36560a4 Mon Sep 17 00:00:00 2001
From: Alex Samorukov <samm@os2.kiev.ua>
Date: Fri, 8 Aug 2014 14:41:44 +0200
Subject: [PATCH] Fix broken build on systems w/o system versioning support
---
Makefile.am | 2 ++
configure.ac | 13 +++++++++++++
2 files changed, 15 insertions(+)
View gist:10690402
$ file *
PORSCHE 996 TWIN TURBO INTERCOOLER INSTALLATION.pdf: PDF document, version 1.5
jpg_to_pdf.pdf: PDF document, version 1.3
test.pdf: PDF document, version 1.4
View gist:6231473
def disable_proxy(kick_token):
path = '/etc/sysconfig/rhn/up2date'
mode = 0600
tempfd, temp_path = mkstemp()
try:
new_file = open(temp_path, 'w')
old_file = open(path)
except (IOError, OSError) as err:
klog(kick_token, 'Problem disabling proxy for RHN <%s>.' % str(err))
return False
View gist:5960687
#!/bin/sh
dur=$1
if [ "$dur" = "" -o ! -e "$dur" ]; then
echo "no package supplied" 1>&2
exit 1
fi
leadsize=96
o=`expr $leadsize + 8`
set `od -j $o -N 8 -t u1 $dur`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
View gist:5827507
#!/usr/bin/env python
get_lenlist = lambda input_data: dict([(key,max([len(str(key))]+[len(str(i[key])) for i in input_data])) for key in input_data[0].keys()])
get_rowformat = lambda length_data: " | ".join('%%-%ss' % max_length for key, max_length in length_data.iteritems())
get_divider = lambda length_data: "-|-".join("-"*max_length for key, max_length in length_data.iteritems())
get_header = lambda length_data: get_rowformat(length_data) % tuple(length_data.keys())
records = [
{ 'name':'Billy Bob', 'Hobby': 'Guns'},