Skip to content

Instantly share code, notes, and snippets.

🤖

Andre LaBranche dreness

🤖
Block or report user

Report or block dreness

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dreness
dreness / tickref.opy
Last active Oct 14, 2019
Displays overwatch instance stats: ticks dropped, ticks counted, ticks expected
View tickref.opy
#!define TICKS A
#!define COUNTING B
#!define NOW C
#!define STARTLAG D
#!define DROPPED E
#!define EXPECTED F
@Rule "fast assemble"
@Event global
if isAssemblingHeroes():
@dreness
dreness / heredoc-examples.md
Created Oct 8, 2019
Shell heredocs and related nestings
View heredoc-examples.md

Zsh: Heredoc inside a command substitution

note the helpful indenting in the prompt

zsh% A=$(
cmdsubst> cat <<EOF
cmdsubst heredoc> boep boewp
cmdsubst heredoc> dootles
cmdsubst heredoc> EOF
@dreness
dreness / Uncloned.swift
Created May 1, 2019
Show something mumble mumble APFS cloned files mumble?
View Uncloned.swift
import Cocoa
// https://cocoa-dev.apple.narkive.com/Ciy40e20/is-cloning-the-same-as-copying-in-apfs#post8
func unclonedSize(of url: URL) throws -> off_t {
var list = attrlist(bitmapcount: UInt16(ATTR_BIT_MAP_COUNT),
reserved: 0,
commonattr: 0,
volattr: 0,
dirattr: 0,
fileattr: 0,
@dreness
dreness / mkbarcodes.py
Last active Sep 24, 2019
make a video of a bunch of generated barcodes using #ffmpeg
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
@dreness
dreness / cc_southpark.py
Last active Sep 24, 2019
cc_southpark.py uses #BeautifulSoup to produce a list of links to #SouthPark episodes
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-"
# a sample item:
'''
@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 Sep 28, 2019
VLCxcallbacker: generate and host a web page of vlc-x-callback links to every video file in a given directory (for #VLC clients on iOS)
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
You can’t perform that action at this time.