Skip to content

Instantly share code, notes, and snippets.

View detrout's full-sized avatar

Diane Trout detrout

  • Caltech - Wold Lab
  • Los Angeles, CA
View GitHub Profile
@detrout
detrout / hashfile
Created December 6, 2022 18:58
Example of generating md5sums.
def make_python_md5sum(filename):
with open(filename, "rb") as instream:
md5 = hashlib.md5()
# for large files this might need to be a loop reading in
# chunks. md5.update will work correctly when being given blocks
block = instream.read()
md5.update(block)
return md5.hexdigest()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@detrout
detrout / block-amazon.py
Created July 15, 2019 20:48
Generate iptables commands to block and unblock amazon. (Unblock untested)
#!/usr/bin/python3
"""Block amazon.
I used https://github.com/joetek/aws-ip-ranges-json as the source of
Amazon IP address ranges so I wouldn't have to download them directly
from Amazon.
This depends on sudo, iptables and ip6tables being available.
git clone https://github.com/joetek/aws-ip-ranges-json
Dask doesn't support the following argument(s).
* buf
* columns
* col_space
* header
* index
* na_rep
* formatters
* float_format
Dask doesn't support the following argument(s).
* buf
* columns
* col_space
* header
* index
* na_rep
* formatters
* float_format
"""A quickly written scraper to extract data from temp-and-precip/climatological-rankings
requires: requests, lxml, and grequests to run
Look to pip or your package panager.
it's likely to take a while to run as it looks like it will require
about 200 million http requests.
It'd be really nice if sites would let you request more than one data point at a time.
@detrout
detrout / org-protocol.desktop
Created November 3, 2016 06:06
Desktop file to use org-protocol with xdg-open AKA GNOME 3 / KDE Plasma 5 (Save to ~/.local/share/applications/org-protocol.desktop
[Desktop Entry]
Version=1.0
Name=org-protocol helper
Comment=helper to allow GNOME to open org-protocol: pseudo-urls
TryExec=/usr/bin/emacsclient
Exec=/usr/bin/emacsclient %u
NoDisplay=true
Icon=emacs24
Terminal=false
Type=Application
@detrout
detrout / gist:d87b89289818d1cfa370
Created July 23, 2015 05:46
start poking gitter
def viewresp(response):
print(response.readLine())
def main():
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import QtNetwork
from PyQt5 import QtWidgets
app = QtWidgets.QApplication(sys.argv)
#!/bin/bash
# /etc/init.d/pumpio
### BEGIN INIT INFO
# Provides: pump.io
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts pump.io as a background daemon
@detrout
detrout / gist:4396dfae354b131f319d
Created June 10, 2014 21:13
check for starting amounts.
{
"metadata": {
"name": "",
"signature": "sha256:6a5b9dfb303e905036e3a15bfa0a3e0b41ad4bf9d5244673e6fdb3ba58c218ea"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [