Skip to content

Instantly share code, notes, and snippets.

View wesleym's full-sized avatar

Wesley Moy wesleym

View GitHub Profile
@wesleym
wesleym / dccheatsheet.txt
Created February 15, 2024 11:36
dc Cheat Sheet
dc Cheat Sheet
==============
[Launching] [Arithmetic]
dc -e "expression" +-*/%^
dc -f infile v square root
[Stack]
p pop d push duplicate x
f print stack r swap x-y
@wesleym
wesleym / logerrorchain.go
Created February 12, 2024 11:48
Log all errors in an error's chain in a manner suitable for errors.Is/errors.As
package util
import (
"errors"
"log"
)
func logErrorChain(err error) {
for err != nil {
log.Printf("(%T).Error() => %+v", err, err)
@wesleym
wesleym / well_documented_fizzbuzz.go
Last active August 9, 2022 18:41
Well-Documented FizzBuzz
// Package main is an executable that implements FizzBuzz.
package main
import "fmt"
// main is a complete run of the FizzBuzz program.
func main() {
// Each iteration represents one of the numbers from 1 to 100
// and corresponds to one line printed to standard output.
@wesleym
wesleym / passwords.google.com.js
Last active July 20, 2017 18:28
Get google passwords from passwords.google.com
// Working as of July 20, 2017
prvBtnz = document.querySelectorAll('.cXmCRb')
var area = document.createElement('textarea');
area.rows = 20;
area.cols = 100;
document.body.prepend(area);
for (var i = 0; i < prvBtnz.length; i++) {

Keybase proof

I hereby claim:

  • I am wesleym on github.
  • I am wesleym (https://keybase.io/wesleym) on keybase.
  • I have a public key ASDy6K4se2S7pERWPwgirS00jC7meJvmEM0r2Q0cdW5hGQo

To claim this, I am signing this object:

@wesleym
wesleym / build.gradle
Created January 4, 2016 23:43
Upgrading to target SDK version 23
android {
defaultConfig {
targetSdkVersion 23
}
}
@wesleym
wesleym / check_updates.sh
Created November 1, 2015 23:05
Fetch a URL and beep when it updates
#!/bin/sh
curl -o new.out $1
while ! diff old.out new.out > /dev/null
do
mv new.out old.out
sleep 5
curl -o new.out $1
done
import os
import re
from PIL import Image, ImageOps
import shutil
import contextlib
sixdigithex = re.compile('#([0-9A-Za-z]{3}(?:[0-9A-Za-z]{3})?)[^0-9A-Za-z]|$')
graypath = 'com.sencha.gxt.ui/src/main/java/com/sencha/gxt/theme/gray/'
for dirpath, dirnames, filenames in os.walk(graypath):
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Sencha GXT Parent Project
[INFO] Sencha GXT
[INFO] Sencha GXT Chart
[INFO] Sencha GXT legacy project
[INFO] Sencha GXT Examples
[INFO] Sencha GXT Release package
@wesleym
wesleym / prune.py
Created May 9, 2012 01:23
Prune empty directories in Subversion checkout
import os
swept = []
for root, dirs, files in os.walk('.', topdown=False):
if root.find('/.svn/') > 0: continue
if files: continue
content = False
for dir in dirs:
if dir != '.svn' and os.path.join(root, dir) not in swept: