Skip to content

Instantly share code, notes, and snippets.

View maxrp's full-sized avatar

Max P maxrp

View GitHub Profile
#!/usr/bin/env bash
DESKS=( ' one ' ' two ' ' three ' ' four ' ' five ' )
battery() {
acpi --battery | \
awk -F, '{print $2}'
}
dual_date() {
@maxrp
maxrp / xephyrize.sh
Created November 2, 2014 20:55
My preferred way of launching a test X server for WM experimentation
#!/bin/bash
# Usage: ./xephyrize 2bwm|dwm|cwm|tinywm
# Define a simple X session
function x_session() {
sleep 1;
$@ &
xterm &
}
@maxrp
maxrp / haversines.py
Last active August 29, 2015 14:12
Another python haversine implementation
#!/usr/bin/env python
import math
# from here: https://gist.github.com/rochacbruno/2883505
def distance(origin, destination):
lat1, lon1 = origin
lat2, lon2 = destination
radius = 6371 # km
@maxrp
maxrp / invoke.sh
Created January 15, 2015 23:16
if something bans based on x-forwarded-for, you might be able to get it to ban stuff
#!/usr/bin/bash
while true; do cat loadbalancer-ips ; done | parallel --jobs 10 'bash sma.sh {} backend.example.com'
@maxrp
maxrp / MS15-034.py
Last active August 29, 2015 14:19
A slightly more durable PoC for MS15-034/CVE-2015-1635
#!/usr/bin/env python
__author__ = "Max R.D. Parmer <[email protected]>"
"""
A moderately more consistent implementation of MS15-034/CVE-2015-1635 PoC
which is a bit more tolerant of redirects and SSL.
For best results, direct at a static file i.e. https://example.com/favico.ico
"""
@maxrp
maxrp / new-case
Last active August 29, 2015 14:19
A simple logbook
#!/bin/bash
## Usage: . new-case 'Investigating whacky happenstance.'
date=`date +%Y-%m-%d`
if [ -d $date ]; then
echo "Case ${date} exists."
cd $date
else
echo "Starting record for ${date}."

Keybase proof

I hereby claim:

  • I am maxrp on github.
  • I am maxp (https://keybase.io/maxp) on keybase.
  • I have a public key whose fingerprint is 260D 9167 F8D9 3913 3564 E571 7D96 4D33 6114 2ACF

To claim this, I am signing this object:

@maxrp
maxrp / chromehistory2csv.sh
Created September 1, 2015 20:57
Dump chrome history with last visit times
#!/bin/bash
sqlite3 "${1}" <<!
.headers on
.mode csv
SELECT urls.url, urls.title, urls.visit_count, datetime(urls.last_visit_time / 1000000 + (strftime('%s', '1601-01-01')), 'unixepoch')
FROM urls, visits WHERE urls.id = visits.url;
!
@maxrp
maxrp / sheetquery.py
Last active October 19, 2015 18:02
notes on google sheets query
#!/usr/bin/python3
# to install dependencies, run: pip install gspread IPy oauth2client
import json
import gspread
import sys
from IPy import IP
from oauth2client.client import SignedJwtAssertionCredentials as jwtassert
#!/bin/bash
# Sets the date on a Veho VCC MUVI-PRO micro camera
# Usage: set_muvi_pro_date.sh /dev/sdb
mount "${1}" /mnt &&
date +"%Y.%m.%d %H:%M:%S" > /mnt/time.txt &&
umount /mnt