Skip to content

Instantly share code, notes, and snippets.

@mdawaffe
mdawaffe / instructions
Created September 1, 2023 23:24
Statically Compiling Nano
# I was targeting a machine using this version of Debian. Hopefully, you're targeting something newer.
docker run --rm -it debian:stretch bash
# This version of Debian is old enough that the package list has been moved to the archives.
# You may not need to do this.
# Note: if you're using a backports distribution, you'll need to do the same for /etc/apt/sources.list.d/*
sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
apt update # Some errors. Seems fine?
# aptitude is easier to use if there are problems/conflicts.
@mdawaffe
mdawaffe / diff-changed-lines.sh
Last active October 4, 2023 08:38
Get line numbers of changed lines - git, diff - Full of bashisms
#!/bin/bash
# Call like you would `diff`
# `./diff-changed-lines.sh old new`
# Outputs the lines numbers of the new file
# that are not present in the old file.
# That is, outputs line numbers for new lines and changed lines
# and does not output line numbers deleted or unchanged lines.
@mdawaffe
mdawaffe / Readme.md
Last active August 1, 2017 03:45
Print Trinet/HR Passport Paystubs

Trinet Paystubs

Prints all your paystubs from Trinet one by one. When saving PDFs, the date is used as the filename.

To Use

  1. Log in to HR Passport.
  2. Myself → My Payroll → Earnings Statements
  3. (Click "View All Paychecks" at the bottom of the page if such a link exists)
@mdawaffe
mdawaffe / mardi-gras.sh
Last active October 22, 2015 05:55
Calculates the Date of Mardi Gras from `ncal -e`
#!/bin/bash
function usage {
echo "$0 [-n NUMBER] [YEAR]"
}
date -j &> /dev/null
if [ $? -eq 0 ]; then
# OS X
function mardigras {
@mdawaffe
mdawaffe / .gitignore
Last active January 25, 2017 05:08
Gmail OAuth2 Transport for Nodemailer
config.json
.credentials
node_modules
@mdawaffe
mdawaffe / totp.php
Last active August 29, 2015 14:08
TOTP PHP Script
#!/usr/bin/env php
<?php
/*
* echo -n "KEY" | php totp.php
*
* --debug: Print the output of each step of the algorithm
* --raw : Use the KEY as is. By default (without --raw), KEY is treated as base32 encoded
*/
@mdawaffe
mdawaffe / object-loops.php
Created October 16, 2014 12:32
Behavior of Various Ways to Loop over a PHP Object with Private/Protected Properties
<?php
class A {
protected $protected = 'protected';
private $private = 'private';
public $public = 'public';
function loop_array() {
foreach ( (array) $this as $key => $value ) {
var_export( "$key => $value" );
@mdawaffe
mdawaffe / 1.txt.asc
Last active August 29, 2015 14:04
Encrypted Messages
-----BEGIN PGP MESSAGE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - https://gpgtools.org
hQEMA0+4ouatXFv0AQgAsJhkxSXK75DOmQmKWdXRVvi+yzo2JFs8c2MSzXXEVgR8
DBd2ox8fnlJMeQCUbCDEogj46zR4C4/apsAiY4gj0qfqJbcuPL78qgAw06Cc/shy
sxZgt/7OA6oPkioi2mTwLGEJKnoStsMiokiJHru01EY9fX39CkpmrjQtBj4ShRnI
Uqj9c8kFpvGmMTxFs2iPEbKqczufWIIzldlYmdeRXRwtXu7vEzytqYcapMVLrILi
/8Stqzmb5fXwzDTJ8aZbiGivbBe3rIHvuFDxgysDHlbSYQhzphsofA6MdPJYmpwh
7ifo45QUp/wkrAzHdsmccjeoWtmmoNL9DmgVXrDhwdLpAf0xnccBFPTqfpBRXsf2
@mdawaffe
mdawaffe / keybase.md
Created July 24, 2014 05:07
Keybase proof

Keybase proof

I hereby claim:

  • I am mdawaffe on github.
  • I am mdawaffe (https://keybase.io/mdawaffe) on keybase.
  • I have a public key whose fingerprint is 9CEF 1DD3 FC16 8031 96F4 0D39 A47A 8785 D991 9CDB

To claim this, I am signing this object:

<?php
/**
* $to_utf8 = Jetpack__To_UTF8::init();
* $data = $to_utf8->convert( $data )
*/
class Jetpack__To_UTF8 {
static $instance;
private $from;