Skip to content

Instantly share code, notes, and snippets.

@dreness
dreness / mkbarcodes.py
Created Apr 1, 2019
make a bunch of barcodes
View mkbarcodes.py
#!/usr/bin/env python3
# make some barcodes, then use ffmpeg to make a video from the individual frames,
# to see how fast FirebaseML can recognize barcodes through the camera.
# https://github.com/azamsharp/FirebaseML.git
# barcode types
# code128 code39 ean ean13 ean14 ean8 gs1
# gtin isbn isbn10 isbn13 issn itf jan pzn upc upca
View cc_southpark.py
#!/usr/bin/env python3
import json
from beautifulscraper import BeautifulScraper
from pprint import pprint as pp
URL = "http://southpark.cc.com/feeds/carousel/video/08f60a6f-24a8-4d88-88a3-eb5588494cbc/30/1/json/views/season-"
def seasonClips(URL):
VIDS = []
@dreness
dreness / mystery_routing.txt
Last active Dec 3, 2018
A routing puzzle for you
View mystery_routing.txt
Question: is there ever a reason to ARP for an IP outside of any local subnets?
Update: I like @bmastenbrook's answer: https://twitter.com/bmastenbrook/status/1069415501296586752
# my subnet is a /24, and 10.0.10.10 is totally not on the same /24 as 10.0.0.42.
xomg% netstat -rn -f inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 10.0.10.10 UGScI 3 0 en0
@dreness
dreness / shadowhash.sh
Last active Mar 17, 2018
Examine shadowhash data from a DSLocal account record in macOS
View shadowhash.sh
#!/bin/bash
if [ -z $1 ]
then
echo "Requires a username as the first and only argument."
exit 1
fi
readShadowhash() {
u=$1
@dreness
dreness / funcs.sh
Created Feb 11, 2018
a few bash techniques for error handling
View funcs.sh
#!/usr/bin/bash
trap "echo inner ERR" ERR
trap "echo inner EXIT" EXIT
aThunk()
{
unsurprisingly
}
@dreness
dreness / VLCxcallbacker.py
Last active Jan 6, 2019
Synthesize and host vlc-x-callback stream links
View VLCxcallbacker.py
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import os
import socket
from datetime import datetime
from urllib import parse
from klein import Klein
from twisted.web.static import File
from twisted.python.filepath import FilePath
@dreness
dreness / schmoVids.py
Last active Dec 17, 2017
Somebody asked what their second-longest video is :)
View schmoVids.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import isodate
import time
import math
import json
import sys
import os
from ytdata import YTData
from datetime import datetime
@dreness
dreness / owl.py
Last active Jan 12, 2018
Reveal OverwatchLeague video URLs
View owl.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Work in progress. For now, just show URLs to m3u8 files of match videos.
To use, first do:
pip install -r requirements.txt
TODO: pre-season VODs were split out by game; season1 VODs contain all games in a match
"""
@dreness
dreness / LSFileInfo.py
Last active Feb 10, 2019
Interrogate LaunchServices to query file paths for default app handler, all possible app handlers, and the UTI
View LSFileInfo.py
#!/usr/bin/env python
import LaunchServices as ls
from Foundation import NSURL
from sys import argv
for arg in argv[1:]:
url = NSURL.fileURLWithPath_(arg)
if url == None: continue
print("\n", url.path())
@dreness
dreness / watch_file.d
Last active Aug 14, 2017
Try to find out who is opening, reading from, writing to, deleting a file
View watch_file.d
#!/usr/sbin/dtrace -s
#pragma D option quiet
#pragma D option switchrate=10hz
/* pass the filename to watch for as the only cli argument */
dtrace:::BEGIN
{
/* double dollar sign to stringify cli arg */
You can’t perform that action at this time.