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 / 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 / throttle.sh
Last active Feb 19, 2019
A script to apply bandwidth limits to specific traffic in OS X using pf and dummynet
View throttle.sh
#!/bin/bash
# Create a file such as /Users/you/Documents/pftable to hold a list of IPs or subnets to throttle.
# Example file contents:
# 1.2.3.4
# 2.3.4.5/16
# Reset dummynet to default config
dnctl -f flush
@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 / plotframetimes.py
Last active May 3, 2018
Graphical and statistical analysis of frame rate in a video
View plotframetimes.py
#!/usr/bin/env python
# dre at mac dot com
# Graphical and statistical analysis of frame rate in a video
# Requires ffmpeg and gnuplot
from sys import platform
from subprocess import check_output
from os import path
import json
import argparse
@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 / 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 / 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 / filesink.rb
Last active Nov 7, 2017
Blather XMPP bot that receives file transfers that are sent using XEP 0096. Not at all complete, but wanted to post something that demonstrates working file transfer, since I couldn't find any.
View filesink.rb
require 'rubygems'
require 'blather/client'
require 'awesome_print'
require 'nokogiri'
require 'pretty-xml'
require 'nokogiri-pretty'
include PrettyXML
# This is a Blather bot that receives file transfers that are sent using
# XEP 0096, using either p2p SOCKS5 (XEP 0065), or through the server
@dreness
dreness / symfind.py
Last active Sep 13, 2017 — forked from pudquick/symfind.py
Automatic symbol definition discovery for OS X binaries and their linked shared libraries
View symfind.py
#!/usr/bin/python
"""Usage: symfind BINARY_PATH SEARCH_STR
symfind automates the usage of otool and nm to attempt to find out which
binary a symbol is defined in that's used within BINARY_PATH's code.
"""
import subprocess, os.path, sys, getopt
You can’t perform that action at this time.