Skip to content

Instantly share code, notes, and snippets.

@abl
abl / ClassyJSON.py
Created February 5, 2013 00:13
Classy JSON encoding/decoding with some fancy features.
import json, re
class MyObject:
pass
class MyExtension(MyObject):
pass
class Object:
pass
#Beginning after the blank line 685 of pebble/pebble.py
if restype == 1:
apps["banks"], apps_installed = unpack("!II", data[1:9])
apps["apps"] = []
appinfo_size = 78
offset = 9
for i in xrange(apps_installed):
app = {}
try:
@abl
abl / hannah-rev3-tmp112.squirrel.js
Last active December 19, 2015 07:39
Smartmaker's temperature example.
imp.configure("Temperature Logger", [], []);
const i2c_temp = 0x92;
hardware.configure(I2C_89);
local i2c = hardware.i2c89;
function ShowTemperature(){
//Poll the temperature every n seconds
imp.wakeup(5,ShowTemperature);
i2c.write(i2c_temp, "\x01\xE1\x30");
imp.sleep(0.050); //50 ms vs rated time of 26 ms
@abl
abl / isdst.js
Created September 10, 2013 16:48
//This is completely ridiculous.
var jan = new Date(this.getFullYear(), 0, 1).getTimezoneOffset();
var jul = new Date(this.getFullYear(), 6, 1).getTimezoneOffset();
var today = new Date().getTimezoneOffset();
if(jan == jul) {
$('#daylight_savings').prop('checked', false);
} else if(jan > jun) {
//Northern hemisphere
$('#daylight_savings').prop('checked', (jun==today));

Keybase proof

I hereby claim:

  • I am abl on github.
  • I am abl (https://keybase.io/abl) on keybase.
  • I have a public key whose fingerprint is A81A 630B 046A 6F83 E08D 3C69 B9F4 68A5 46E4 AAE4

To claim this, I am signing this object:

@abl
abl / wordlist.txt
Last active August 29, 2015 14:15 — forked from ehedaya/wordlist.txt
Wordlist ver 0.732 - EXPECT INCOMPATIBLE CHANGES;
acrobat africa alaska albert albino album
alcohol alex alpha amadeus amanda amazon
america analog animal antenna antonio apollo
april aroma artist aspirin athlete atlas
banana bandit banjo bikini bingo bonus
camera canada carbon casino catalog cinema
citizen cobra comet compact complex context
credit critic crystal culture david delta
dialog diploma doctor domino dragon drama
[
{
"action": {
"type": "block"
},
"trigger": {
"url-filter": ".*",
"resource-type": ["script"],
"load-type": ["third-party"],
"if-domain": ["imore.com"]
@abl
abl / .zshrc
Last active December 3, 2023 18:41
abl's universal .zshrc
if [[ -f "/mnt/c/WINDOWS/system32/wsl.exe" ]]; then
# We're in WSL, which defaults to umask 0 and causes issues with compaudit
umask 0022
if [[ "${PWD}" = "/mnt/c/Users/${USER}" ]]; then
# We're in a default WSL shell
cd "${HOME}"
fi
fi
if [[ ! -d "$HOME/.zinit" ]]; then
@abl
abl / ErrorOnForceUnwrap.swift
Created June 16, 2018 01:32
ErrorOnForceUnwrap.swift
// Copyright 2018 Google LLC.
// SPDX-License-Identifier: Apache-2.0
import Foundation
import SwiftSyntax
public class DiagnoseForceUnwraps: SyntaxVisitor {
public let engine: DiagnosticEngine
public let file: URL
// Copyright 2018 Google LLC.
// SPDX-License-Identifier: Apache-2.0
import Foundation
import SwiftSyntax
public class IncrementIntegers: SyntaxRewriter {
public override func visit(_ token: TokenSyntax) -> Syntax {
guard case .integerLiteral(let intToken) = token.tokenKind else {
return token