Skip to content

Instantly share code, notes, and snippets.

Markham Anderson entrity

Block or report user

Report or block entrity

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
entrity / demo.rb
Created Sep 25, 2019
A coding demo for a job application at Theorem, LLC. "Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers."
View demo.rb
# Here's a function to flatten an array of arbitrarily nested arrays of
# integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
# This was written for Ruby 2
# Invoke this function by passing it the array to be flattened in the
# "input" argument and leaving the "output" argument nil.
# E.g.
# >> recursive_flatten([[1,2,[3]],4])
entrity /
Created Jul 14, 2018
GPG Quick Start

Create a key pair and export the public key

gpg --gen-key # To create your key
gpg --export <your_id> > hazel-public.asc # To export your key to a file

Import someone else's public key. Sign and encrypt a file for them.

View gist:41c76fbf272ce1d517fe4bd887583f9c

In favour of ruby

  • Ruby allows lambdas that are longer than a single expression
  • Ruby doesn't have semantic whitespace. (Especially an issue when working in an interactive session.)
  • Ruby functions always return something, so more functions lend themselves to easy, legible chaining
  • Ruby doesn't require unnecessary specifications of both self and class to designate a member function
  • Ruby interpreter looks for rc files to customize your startup

In favour of Python

entrity /
Last active Mar 29, 2018
Toggle whether the "immutable" flag is set on a file. (Works only on EXT file systems.)
# Toggle the "immutable" flag on a file. This flag will prevent you from
# removing or rewriting a file, even if you have permissions or or root.
# Usage:
# $0 <filepath> [on|off]
# $0 <dirpath> [on|off]
# If the argument is a file and no second argument (on/off) is given, then
View sqlite db contents
sqlite> select * from notes;
1|MTUxNjc2OTYw|1342697561419|1516769609|-1||Chinese fooddim sum|Chinese food|3355160037|0|
2|MTUxNjc2OTYw|1342697561419|1516769609|-1||Korean foodbulgogi|Korean food|2729990631|0|
sqlite> select * from cards;
sqlite> select * from col;

This is a user script for Chrome. It provides hotkeys for two modes of dictation (replacement and insertion).

The included shell script was used when I was looking at doing this with a bookmarklet.

View .joy2keyrc
# Config for PS2 Barracuda 1
# buttons are: X A B Y L2 R2 L1 R1 sel start
-dev /dev/input/js0
-thresh -32767 32767 -32767 32767 -32767 32767 -32767 32767 -32767 32767 -32767 32767
-axis Left Right Up Down Left Right Up Down Left Right Up Down
-buttons S X Z A D C D C ShiftR Return
entrity / kswitch
Last active Aug 29, 2015
text file for config
# rm tipsy files
# rm tipsy dbs
entrity /
Last active Jan 12, 2016
Read/write the brightness on my Ubuntu 14.04 LTS installation on my ThinkPad 440s.

Convenient CLI and GUI for adjusting the brightness on my Ubuntu installation in my Thinkpad T440

You can’t perform that action at this time.