Skip to content

Instantly share code, notes, and snippets.

@mdawaffe
mdawaffe / diff-changed-lines.sh
Last active Mar 19, 2021
Get line numbers of changed lines - git, diff - Full of bashisms
View diff-changed-lines.sh
#!/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 Aug 1, 2017
Print Trinet/HR Passport Paystubs
View Readme.md

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 Oct 22, 2015
Calculates the Date of Mardi Gras from `ncal -e`
View mardi-gras.sh
#!/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 Jan 25, 2017
Gmail OAuth2 Transport for Nodemailer
View .gitignore
config.json
.credentials
node_modules
@mdawaffe
mdawaffe / totp.php
Last active Aug 29, 2015
TOTP PHP Script
View totp.php
#!/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 Oct 16, 2014
Behavior of Various Ways to Loop over a PHP Object with Private/Protected Properties
View object-loops.php
<?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 Aug 29, 2015
Encrypted Messages
View 1.txt.asc
-----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
View keybase.md

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:

View to-utf8.php
<?php
/**
* $to_utf8 = Jetpack__To_UTF8::init();
* $data = $to_utf8->convert( $data )
*/
class Jetpack__To_UTF8 {
static $instance;
private $from;
View index.php
<?php
if ( $_POST ) {
var_dump( $_POST, $_FILES );
exit;
}
?>
<!DOCTYPE html>
<html>