Skip to content

Instantly share code, notes, and snippets.

View ke4roh's full-sized avatar

Jim Scarborough ke4roh

View GitHub Profile
@ke4roh
ke4roh / exportAttachments
Created September 15, 2020 22:46
Export attachments from an iPhone backup
#!/bin/bash
# Construct a tree of folders to match the structure
# (below the root) given for iPhone text message
# attachments, using symbolic links to the actual files
# in the backup.
#
# The text message file is 3d0d7e5fb2ce288813306e4d4636395e047a3d28
# See also https://osxdaily.com/2010/07/08/read-iphone-sms-backup/
# https://commons.erau.edu/cgi/viewcontent.cgi?article=1099&context=jdfsl
@ke4roh
ke4roh / prune
Last active December 3, 2019 19:41
Prune merged branches from git local and remote
#!/bin/bash
# This will prune merged and deleted branches from your git repository.
# It assumes you're on a "master" branch tracking the origin you like.
#
# To run it, you need git (duh), perl, cut, grep and xargs. Pretty standard stuff.
git=/usr/bin/git
master=$(git branch | grep "^\*" | cut -f2 -d\ )
@ke4roh
ke4roh / ccmonitor.sh
Created February 1, 2019 16:39
Monitor the charging station at the Raleigh City Center parking deck and report its status to Google Chat
#!/bin/bash
. ./.cccreds
function ccstatus {
curl -X POST \
http://periscope.raleighnc.gov/periscopeApi/sustainability.getEvFocusXml \
--data-binary '<str name="val" val="" />' \
-H 'Content-type: text/xml' \
--compressed \
@ke4roh
ke4roh / scrapelists.py
Created June 29, 2017 14:28
Fetch Amy Siskind's Authoritarianism list
#!/usr/bin/env python3
import os
lists=list([x.strip().split(": ",1)[1] for x in
"""Week 1: https://goo.gl/KWlyOO Week 2: https://goo.gl/Pn7MFs
Week 3: https://goo.gl/CZwxsX Week 4: https://goo.gl/JhwuON
Week 5: https://goo.gl/TGM6x8 Week 6: https://goo.gl/uhyjxe
Week 7: https://goo.gl/bMdhTG Week 8: https://goo.gl/89MW8h
Week 9: https://goo.gl/ekv9wE Week 10: https://goo.gl/RETyH1
Week 11: https://goo.gl/6cs0tt Week 12: https://goo.gl/bRMx5o
@ke4roh
ke4roh / fetchertest.py
Created February 14, 2017 15:47
Circuits framework parallel fetching example - broken
#!/bin/env python3
from circuits.web.client import Client, request as request_event
from circuits.web import Server, Controller
from circuits import handler, Debugger
class Root(Controller):
channel = "web"
def __init__(self):
@ke4roh
ke4roh / sslserver.py
Created February 10, 2017 15:06
Circuits Framework SSL web with redirector
#!/usr/bin/env python3
from circuits import Debugger, BaseComponent, handler
from circuits.web import Controller, Server
from circuits.web.errors import redirect
from urllib.parse import urlparse, urlunparse
class Root(Controller):
def index(self):
return "Hello World!"
@ke4roh
ke4roh / git-show-big
Last active April 22, 2017 12:11
Show large objects in the git repo for cleaning cruft
$ cat git-show-big
#!/bin/bash
# Ref http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history
SHAS=$(git rev-list --objects --all | sort -k 2)
BIGOBJS=$(git gc && git verify-pack -v .git/objects/pack/pack-*.idx | egrep "^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$" | sort -k 3 -n -r)
join <(echo "$BIGOBJS" | sort ) <(echo "$SHAS" | sort ) | sort -k 3 -n -r | cut -f 1,3,6- -d\
@ke4roh
ke4roh / lab1SchemaSetup.sh
Created October 13, 2015 15:50
Solr Under The Hood Getting Started field definition
#!/bin/bash
curl http://localhost:8983/solr/gettingstarted/schema -D - -X POST -H \
'Content-type:application/json' --data-binary '{
"add-field" : {
"name":"name",
"type":"text_general",
"stored":true
},
"add-field" : {
@ke4roh
ke4roh / findJavaHome.sh
Created August 5, 2015 16:52
Where is JAVA_HOME?
#!/bin/bash
function whereIsFile() {
pushd . > /dev/null
FILE_PATH=$1;
while([ -h "${FILE_PATH}" ]) do cd -P $(dirname "${FILE_PATH}"); FILE_PATH=$(readlink "${FILE_PATH}"); done
cd -P $(dirname "${FILE_PATH}") > /dev/null
echo $(pwd)
popd >/dev/null
}
@ke4roh
ke4roh / whereIsFile.sh
Created August 5, 2015 15:03
Find out where the symbolic links bottom out
#!/bin/sh
FILE_PATH=$1;
while([ -h "${FILE_PATH}" ]) do cd -P $(dirname "${FILE_PATH}"); FILE_PATH=$(readlink "${FILE_PATH}"); done
cd -P $(dirname "${FILE_PATH}") > /dev/null
echo $(pwd);