Skip to content

Instantly share code, notes, and snippets.

View henrycjc's full-sized avatar

Henry Chladil henrycjc

  • Polymathian Industrial Mathematics
  • Brisbane, Australia
View GitHub Profile
@henrycjc
henrycjc / great_gists.txt
Created February 12, 2022 09:55
great gists
https://gist.github.com/jboner/2841832
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
@henrycjc
henrycjc / bulk.py
Last active November 2, 2017 22:58
NFC bulk encoder script
import nfc
import ndef
tags = set()
rec = ndef.UriRecord("https://google.com")
def on_connect(tag):
if tag.identifier not in tags:
@henrycjc
henrycjc / xmlpretty.py
Created October 9, 2017 01:54
xmlpretty.py
import lxml.etree as et
xmldoc = et.parse("plan.xml")
f = open("output.xml", 'w')
f.write(et.tostring(xmldoc, pretty_print=True))
/*
MIT License
Copyright (c) 2016 Henry Chladil
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@henrycjc
henrycjc / NFCHelper.java
Created August 3, 2016 07:13
Basic helper class for dealing with NFC on Android
/*
MIT License
Copyright (c) 2016 Henry Chladil
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is