Skip to content

Instantly share code, notes, and snippets.

View entrity's full-sized avatar

Markham Anderson entrity

View GitHub Profile

These are convenience scripts for encrypting/decrypting files with a password, salt, and an algorithm of your choice.

After performing the encryption/decryption, the script will ask whether you want to move the source files to the trash (using trash-cli). This option defaults to No.

These scripts will not overwrite any existing files but rather will exit with an error code if an existing file blocks their operation.

Algorithm

The algorithm defaults to aes-256-cbc, but you can set an environment variable ALGORITHM to override it.

@entrity
entrity / Brighten.md
Last active January 12, 2016 04:42
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

# rm tipsy files
# rm tipsy dbs
@entrity
entrity / kswitch
Last active August 29, 2015 14:28
text file for config
test
# Config for PS2 Barracuda 1
# buttons are: X A B Y L2 R2 L1 R1 sel start
COMMON
-X
-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

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.

@entrity
entrity / sqlite db contents
Created January 24, 2018 05:05
Test Anki Deck
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;
1|1|1|0|1516769609|-1|0|0|484332854|0|0|0|0|0|0|0|0|
2|2|1|0|1516769609|-1|0|0|484332854|0|0|0|0|0|0|0|0|
sqlite> select * from col;
1|1332961200|1398130163295|1398130163168|11|0|0|0|{"nextPos":1,"estTimes":true,"activeDecks":[1],"sortType":"noteFld","timeLim":0,"sortBackwards":false,"addToCur":true,"curDeck":1,"newBury":true,"newSpread":0,"dueCounts":true,"curModel":"1398130163168","collapseTime":1200}|{"1342697561419":{"vers":[],"name":"Basic","tags":[],"did":1398130078204,"usn":-1,"req":[[0,"all",[0]]],"flds":[{"name":"Front","rtl":false,"sticky":false,"media":[],"ord":0,"font":"Arial","size":12},{"name":"Back","rtl":false,"sticky":false,"media":[],"ord":1,"font":"Arial","size":12}],"sortf":0,"latexPre":"\\documentclass[12pt]{article}\n\\special{papersize=3in,5in}\n\\u
@entrity
entrity / set_immutable_file.py
Last active March 29, 2018 04:08
Toggle whether the "immutable" flag is set on a file. (Works only on EXT file systems.)
#!/usr/bin/python2
# 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

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
entrity / README.md
Created July 14, 2018 19:40
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.