Skip to content

Instantly share code, notes, and snippets.

View hertzg's full-sized avatar
🎯
Focusing

George Hertz hertzg

🎯
Focusing
View GitHub Profile
@hertzg
hertzg / fun.coffee
Last active August 29, 2015 14:15 — forked from fson/fun.coffee
# factorial
$ = (_) ->
__ = _
--__ && _ = _ * $ __
_
# each
$$ = (_, __) ->
# set a fancy prompt (non-color, overwrite the one in /etc/profile)
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01m\][ \[\033[01;31m\]\u@\h \[\033[00m\]\[\033[01m\]] \[\033[01;32m\]\w\[\033[00m\]\n\[\033[01;31m\]#\[\033[00m\] '
else
PS1='\[\033[01m\][ \[\033[01;34m\]\u@\h \[\033[00m\]\[\033[01m\]] \[\033[01;32m\]\w\[\033[00m\]\n\[\033[01;34m\]$\[\033[00m\] '
fi
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install', '--save', 'ofe' ]
2 info using npm@2.6.1
3 info using node@v0.12.0
4 verbose node symlink /usr/local/bin/node
5 silly cache add args [ 'ofe', null ]
6 verbose cache add spec ofe
7 silly cache add parsed spec { raw: 'ofe',
7 silly cache add scope: null,
7 silly cache add name: 'ofe',
@hertzg
hertzg / .mpdconf
Last active August 29, 2015 14:19 — forked from robcowie/.mpdconf
## ~/.mdpconf
port "6600"
music_directory "~/Music/"
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/mpd.db"
log_file "~/.mpd/mpd.log"
pid_file "~/.mpd/mpd.pid"
state_file "~/.mpd/state"
#bind_to_address "~/.mpd/mpd.sock"
@hertzg
hertzg / persistence.xml
Last active August 29, 2015 14:26 — forked from mortezaadi/persistence.xml
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->
@hertzg
hertzg / easter.js
Created May 3, 2017 16:32
αƒαƒ¦αƒ“αƒ’αƒαƒ›αƒ˜αƒ‘ αƒ’αƒαƒ›αƒαƒ›αƒ—αƒ•αƒšαƒ”αƒšαƒ˜ αƒ˜αƒ£αƒšαƒ˜αƒ£αƒ αƒ˜ და αƒ’αƒ αƒ”αƒ’αƒαƒ αƒ˜αƒαƒœαƒ£αƒšαƒ˜ αƒ™αƒαƒšαƒ”αƒœαƒ“αƒ αƒ”αƒ‘αƒ˜αƒ‘αƒ—αƒ•αƒ˜αƒ‘ (არა αƒαƒžαƒ’αƒ˜αƒ›αƒ˜αƒ–αƒ˜αƒ αƒ”αƒ‘αƒ£αƒšαƒ˜)
function easterDate(yy) {
return {
julian: (function(yy){
var w = yy % 19
, x = yy % 4
, y = yy % 7
, z = (19 * w + 15) % 30
, v = (2 * x + 4 * y + 6 * z + 6) % 7
, zv = z + v
, m
@hertzg
hertzg / debug.js
Created November 9, 2017 12:52 — forked from ptomato/debug.js
GJS debugger
const GLib = imports.gi.GLib;
const Lang = imports.lang;
const System = imports.system;
let _breakpoints = 0;
function _getCurrentStack() {
try {
throw new Error();
} catch (e) {
@hertzg
hertzg / save.py
Created March 30, 2019 15:32 — forked from mickael9/save.py
Factorio map metadata parser
from zipfile import ZipFile
from struct import Struct
class Deserializer:
u16 = Struct('<H')
u32 = Struct('<I')
def __init__(self, stream):
self.stream = stream
@hertzg
hertzg / footgun.md
Created August 13, 2019 13:20 — forked from Rich-Harris/footgun.md
Top-level `await` is a footgun

Edit β€” February 2019

This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:

  • TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
  • In the wild, we're seeing (async main(){...}()) as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems
  • Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.

I'll leave the rest of this document unedited, for archaeological

@hertzg
hertzg / notes.txt
Created September 4, 2020 16:11
etekcity esn00 protocol samples.txt
<Buffer fe ef c0 a2 e0 01 00 e1> - err on
<Buffer fe ef c0 a2 e0 01 01 e2> - err off
<Buffer fe ef c0 a2 d3 01 00 d4> - Tare set/update
<Buffer fe ef c0 a2 d3 01 01 d5> - Tare off
<Buffer fe ef c0 a2 e4 01 00 e5> - Item on scale
<Buffer fe ef c0 a2 e4 01 01 e6> - No item on scale
<Buffer fe ef c0 a2 d0 05 01 06 4a 00 01 27> - sld - g - t - -161