Skip to content

Instantly share code, notes, and snippets.

View danielcompton's full-sized avatar

Daniel Compton danielcompton

View GitHub Profile
@danielcompton
danielcompton / gist:6724333
Created September 27, 2013 04:53
Excel formula for calculating NZ tax paid on annual income.
=IF(B2<=14000,SUM(B2*10.5%),IF(B2<=48000,SUM(B2-14000)*17.5%+1470,IF(B2<=70000,SUM(B2-48000)*30%+7420,IF(B2>=70001,SUM(B2-70000)*33%+14020))))
@danielcompton
danielcompton / ext.clj
Last active July 5, 2021 15:53
Extended attributes in Clojure
(defn supports-extended-attributes?
"Not all filesystems suport Java's UserDefinedFileAttributes (a.k.a. extended attributes),
notably HFS+ and APFS on macOS.
Waiting for https://bugs.openjdk.java.net/browse/JDK-8030048 to add macOS support."
[^Path path]
(.supportsFileAttributeView
(Files/getFileStore path)
^Class UserDefinedFileAttributeView))
@danielcompton
danielcompton / gist:9719633
Created March 23, 2014 06:48
Data Science Learning
- [ ] Math
- [ ] Linear Algebra
- [ ] Lay - Linear Algebra
- [ ] 18.06 Linear Algebra
http://www.scotthyoung.com/blog/mit-challenge/#more-link1806
- [ ] Burke Lecture Notes
http://www.math.washington.edu/~burke/crs/407/lectures/
- [ ] Coding The Matrix
http://www.amazon.com/dp/0615880991/?tag=coursera-course198-20
- [ ] Quantifying Uncertainty
Subscription
Trial
billing_success -> Active
billing_failed -> Past Due
cancel -> Cancelled
Active
billing_success -> Active
billing_failed -> Past Due
cancel -> Cancelled
Past Due
@danielcompton
danielcompton / Clojure 1.10.0-beta5 stack trace
Last active November 8, 2018 02:33
Stack traces in Clojure 1.9 and Clojure 1.10 when you have compile errors in your user namespace
$ lein test
Exception in thread "main" java.lang.ExceptionInInitializerError
at clojure.main.<clinit>(main.java:20)
Tests failed.
@danielcompton
danielcompton / hexml.sh
Created March 14, 2012 00:39
Shell script to convert hex encoded XML to cleanly formatted XML
#! /bin/sh
xxd -revert -plain $1 > /tmp/hexmltemp.xml
xmllint --format /tmp/hexmltemp.xml > $1
@danielcompton
danielcompton / gist:5582392
Last active June 5, 2018 15:48
List directory with up to 8 million files. Script taken from https://coderwall.com/p/h6rifq Download the file, compile it: gcc listdir.c -o listdir And use it like this: ./listdir [target dir] > target-ls.txt
#define _GNU_SOURCE
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#define handle_error(msg) \
@danielcompton
danielcompton / backblaze.crash
Created January 7, 2018 00:29
Backblaze crash when opening Exclusions panel
Process: System Preferences [767]
Path: /Applications/System Preferences.app/Contents/MacOS/System Preferences
Identifier: com.apple.systempreferences
Version: 14.0 (14.0)
Build Info: SystemPrefsApp-360000000000000~1
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: System Preferences [767]
User ID: 503
@danielcompton
danielcompton / networking.tf
Created December 12, 2017 20:45
GCP and DNSimple dual DNS records with Terraform
module "deps_dns_app_v6" {
source = "../modules/dns_record"
name = "app"
type = "AAAA"
value = "${google_compute_global_address.deps-ipv6.address}"
}
module "deps_return_path" {
source = "../modules/dns_record"
name = "return-path"
@danielcompton
danielcompton / .block
Last active November 14, 2016 10:21
re-frame trace
license: mit
border: yes
scrolling: no