Skip to content

Instantly share code, notes, and snippets.

View debedb's full-sized avatar

Gregory Golberg debedb

View GitHub Profile
@debedb
debedb / MockUtils.java
Created April 9, 2021 16:58
Utilities for mocking DB calls
import java.sql.Array;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.time.Instant;
import java.util.Arrays;
import java.util.Base64;
import java.util.HashSet;
@debedb
debedb / pom-compare.py
Created February 10, 2021 20:37
Quick diff between pom dependencies
#!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
from packaging import version
import sys
# files produced from pom.xml by
# mvn dependency:list -f pom.xml | grep "] " | sed 's/.*]\ \ \ \ //g' | sort | uniq
# arg1 - current file
# arg2 - "should-be" file
cur = open(sys.argv[1])
import arrow
def perc(n):
try:
return "%0.1f" % (float(n)/tot*100)
except Exception, e:
raise Exception("Error in %s (%s): %s" % (n, type(n), e))
f = open('/tmp/rows.csv')
tot = 0
@debedb
debedb / jardiff.py
Created January 13, 2020 23:01
JAR diff
import argparse
import os
import sets
import subprocess
import sys
import tempfile
"""
Assumes procyon:
@debedb
debedb / dupes.py
Last active December 27, 2017 02:37
Find duplicate files
#!/usr/bin/python
import pprint
import os
import sys
import hashlib
import sets
import argparse
import signal
@debedb
debedb / dhcp.conf
Created August 29, 2017 02:35
vmnet2 sample (/Library/Preferences/VMware Fusion/vmnet2/dhcd.conf)
# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet2.
#
# This file was automatically generated by the VMware configuration program.
# See Instructions below if you want to modify it.
#
# We set domain-name-servers to make some DHCP clients happy
# (dhclient as configured in SuSE, TurboLinux, etc.).
# We also supply a domain name to make pump (Red Hat 6.x) happy.
#
@debedb
debedb / etcdrmrf.sh
Created August 23, 2017 20:21
Remove everything from etcd
#!/bin/csh
foreach x (`etcdctl ls --recursive | sort -r | uniq`)
etcdctl rmdir $x
end
etcdctl ls --recursive /
@debedb
debedb / turbotaxfile.py
Last active July 16, 2017 05:33
Quick sort of receipts into folders based on TurboTax clasification
import time
import os
import sys
import shutil
from subprocess import Popen
reader = 'open'
# Inventory, Taxes_and_Licenses, Advertising, Insurance, Interest,
# Rental, Commissions, Contract Labor, Repairs and Maintenance,
@debedb
debedb / formMarshaller.go
Created November 16, 2016 19:39
formMarshaller provides functionality to marshal/unmarshal data to/from HTML form format.
// formMarshaller provides functionality to marshal/unmarshal
// data to/from HTML form format.
type formMarshaller struct{}
func (j formMarshaller) Marshal(v interface{}) ([]byte, error) {
retval := ""
vPtr := reflect.ValueOf(v)
vVal := vPtr.Elem()
vType := reflect.TypeOf(vVal.Interface())