Skip to content

Instantly share code, notes, and snippets.

Avatar

debedb debedb

View GitHub Profile
@debedb
debedb / Generic usage of Google Ads API using reflection
Created Jun 26, 2021
Generic usage of Google Ads API using reflection
View Generic usage of Google Ads API using reflection
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.google.ads.googleads.v6.services.GoogleAdsVersion;
import com.google.api.gax.core.BackgroundResource;
import com.google.protobuf.AbstractMessage;
@debedb
debedb / MockUtils.java
Created Apr 9, 2021
Utilities for mocking DB calls
View MockUtils.java
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;
View OAuth1AuthorizationHeaderBuilder.java
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 Feb 10, 2021
Quick diff between pom dependencies
View pom-compare.py
#!/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])
View gist:4b6249bebea8cd69366096aa85b4a088
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
View jardiff.py
import argparse
import os
import sets
import subprocess
import sys
import tempfile
"""
Assumes procyon:
@debedb
debedb / dupes.py
Last active Dec 27, 2017
Find duplicate files
View dupes.py
#!/usr/bin/python
import pprint
import os
import sys
import hashlib
import sets
import argparse
import signal
@debedb
debedb / dhcp.conf
Created Aug 29, 2017
vmnet2 sample (/Library/Preferences/VMware Fusion/vmnet2/dhcd.conf)
View dhcp.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 Aug 23, 2017
Remove everything from etcd
View etcdrmrf.sh
#!/bin/csh
foreach x (`etcdctl ls --recursive | sort -r | uniq`)
etcdctl rmdir $x
end
etcdctl ls --recursive /
@debedb
debedb / turbotaxfile.py
Last active Jul 16, 2017
Quick sort of receipts into folders based on TurboTax clasification
View turbotaxfile.py
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,