Skip to content

Instantly share code, notes, and snippets.

View h's full-sized avatar

Samuel Hoffstaetter h

View GitHub Profile
@h
h / godaddy_domain_price.py
Last active April 21, 2021 22:50
Find Domain Names For Sale (Dictionary Search)
import requests
import time
def do_search(accum):
response = requests.post(
url='https://api.godaddy.com/v1/domains/available?checkType=FULL',
json=accum,
headers={
'Authorization':
'sso-key e4MvWuN8tY8y_4mokbPmCZJb79RzQwkX4wq:4mowrQLTLwu2pAzJdbz8E3'
#!/bin/bash
## This minimalist git pre-commit verifies that you did not add
## the string "DO NOT SUBMIT" or "DO NOT COMMIT" or merge
## conflict pmarkers. However, pre-existing occurrences of these
## strings are ignored (since that would be annoying).
## INSTRUCTIONS
##
## Save this file as ~/.git-hooks/pre-commit
@h
h / Unsubscribe All
Last active March 3, 2021 01:49
Delete all Email Subscriptions
Add the following gmail filters to trash all messages from useless subscription lists.
Do this for both gmail filters below:
1. Login to Gmail and click Settings->Filters->Create a new filter
2. Paste the Gmail filter into the "Has the words" text field
3. Click "Create filter with this Search »", then "Delete it", then "Create filter"
# Gmail filter that deletes all subscription spam (anything with an "unsubscribe" button):
@h
h / Render PyPlot as PNG.py
Last active August 4, 2016 07:04
How to render a PyPlot graph as a PNG file
"""How to render a PyPlot graph as a PNG file"""
from matplotlib import pyplot
import pandas
# First, generate some PyPlot image
data = pandas.DataFrame({'a': [1,2,8], 'b': [4,7,6]})
my_plot = data.plot()
my_plot.set_title("My plot title")
my_plot.set_ylabel('Foo Label')
@h
h / Re-writing Git History.md
Last active July 24, 2016 20:15
Rewriting git history with filter-branch

Advanced git history re-writing with "git filter-branch"

Background: I recently published the Eureka source code. The code was embedded in a much larger repository, and I only wanted to include files in the "eureka/" subdirectory. I wanted to include history only for commits that thouched those files. Below are a few commands that turned out useful.

Rewriting git history with filter-branch

To modify the content of a file (across entire repository history):

$ git filter-branch -f --prune-empty --tree-filter 'sed -i "" "s/BAD TEXT/GOOD TEXT/" eureka/*'