Skip to content

Instantly share code, notes, and snippets.

View aaronjanse's full-sized avatar

Aaron Janse aaronjanse

  • Berkeley, CA
View GitHub Profile
@aaronjanse
aaronjanse / anglediff.js
Created June 20, 2016 21:42
find the smallest distance between two angles
// from http://stackoverflow.com/a/7869457
// converted to js code
// x and y are the angles in radians
function getDifference(x, y) {
var a = x-y;
a = (function(i, j) {return i-Math.floor(i/j)*j})(a+Math.PI, Math.PI*2); // (a+180) % 360; this ensures the correct sign
a -= Math.PI;
return a;
}
@aaronjanse
aaronjanse / burschcleaner.user.js
Last active September 27, 2016 22:20
Bursch Blog Cleaner
// ==UserScript==
// @name Bursch Blog Cleaner
// @version 1.0
// @description This makes Mr.Bursch's blog legible!
// @author Aaron Janse
// @match http://mrbursch.blogspot.com/*
// @grant none
// ==/UserScript==
(function() {
@aaronjanse
aaronjanse / fix.sh
Created August 21, 2017 14:37
Magical command to make gpg work with YubiKey smartcard
killall gpg-agent && gpg-agent --daemon --use-standard-socket --pinentry-program /usr/local/bin/pinentry

Keybase proof

I hereby claim:

  • I am aaronduino on github.
  • I am aaronjanse (https://keybase.io/aaronjanse) on keybase.
  • I have a public key ASBem7Vx9_aAoQlepr-BE9ehqPKTg6Lea5cFPrzSCg39-go

To claim this, I am signing this object:

@aaronjanse
aaronjanse / README.md
Last active October 14, 2017 19:02
A simple command to check how many commits have not been pushed/pulled

Shows how many commits ahead and behind git remotes are.

How to run:

bash remote_status.sh [remote]

The remote defaults to origin

(optional) Installation:

@aaronjanse
aaronjanse / sshd_config
Created April 13, 2018 22:17
Default Arch Linux /etc/ssh/sshd_config
# $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@aaronjanse
aaronjanse / shamir.go
Last active May 31, 2018 03:30
An easy way to do shamir secret sharing from the command line
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"strings"
sssa "github.com/SSSAAS/sssa-golang"
@aaronjanse
aaronjanse / README.md
Created April 30, 2018 17:43
Arch Linux - resize root partition
@aaronjanse
aaronjanse / README.md
Created April 30, 2018 21:09
Resize Arch Linux display

Look for the name in your display (e.g. VGA-1) and possible resolutions (e.g. 1280x768) in

xrandr -q | head

And resize your display like so:

xrandr --display :0 --output NAME_OF_YOUR_DISPLAY --mode WIDTHxHEIGHT
@aaronjanse
aaronjanse / README.md
Created May 18, 2018 23:32
RISC-V 32-bit machine code breakdown
31        26        21        16        11   9     6           0
vv        vv        vv        vv        vv  vv    vv          vv
'F'E'D'C'B'A'9'8'7'6'5'4'3'2'1'0 F E D C B A 9 8 7 6 5 4 3 2 1 0
[ jump target                                  25][ opcode    7]  J-type
[ rd    5][ upper immediate                    19][ opcode    7]  U-type
[ rd    5][ rs1   5][ immhi 5][ immlo     7][fun3][ opcode    7]  I-type
[ immhi 5][ rs1   5][ rs2   5][ immlo     7][fun3][ opcode    7]  B-type
[ rd    5][ rs1   5][ rs2   5][ funct          10][ opcode    7]  R-type
[ rd 5][ rs1 5][ rs2 5][ rs3 5][ funct 5][ opcode 7] R4-type