Skip to content

Instantly share code, notes, and snippets.

@jsgoyette
jsgoyette / vaultfile
Last active September 6, 2023 03:29
Create encrypted volume file
# derived from: https://opensource.com/article/21/4/linux-encryption
# create empty file
dd if=/dev/urandom of=vaultfile.img bs=1M count=512
# create LUKS volume
cryptsetup --verify-passphrase luksFormat vaultfile.img
# open the LUKS volume
sudo cryptsetup open --type luks vaultfile.img vault
@jsgoyette
jsgoyette / screenrc
Last active November 19, 2017 06:14
activity "%c activity -> %n%f %t"
altscreen on
autodetach on
defbce on
deflogin on
defflow off
defscrollback 2048
defutf8 on
msgwait 4
nethack on
@jsgoyette
jsgoyette / RAM FS (Mac OSX)
Created January 28, 2017 22:14
Creates a volatile memory-only drive
#!/bin/bash
ramfs_size_mb=64
mount_point=/private/tmp/ramfs
# must run as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@jsgoyette
jsgoyette / vlookup.js
Last active September 9, 2016 05:02
Example vlookup with node.js
const fs = require('fs')
const _ = require('underscore');
const baby = require('babyparse');
const jmespath = require('jmespath');
// csv parse options
const parseOptions = {
header: true,
skipEmptyLines: true
};
@jsgoyette
jsgoyette / vimrc
Last active April 11, 2017 06:10
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-commentary'

Keybase proof

I hereby claim:

  • I am jsgoyette on github.
  • I am jsgoyette (https://keybase.io/jsgoyette) on keybase.
  • I have a public key whose fingerprint is 3831 42C7 D636 E549 31C1 213A B9CB AD27 5F02 C019

To claim this, I am signing this object:

////////////////////////////////////////////////////////////////////////////////
// SEND EMAIL
////////////////////////////////////////////////////////////////////////////////
require_once('include/SugarPHPMailer.php');
$emailObj = new Email();
$defaults = $emailObj->getSystemDefaultEmail();
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
$mail->From = $defaults['email'];
@jsgoyette
jsgoyette / pre-commit
Last active December 17, 2015 23:58
Git pre-commit hook - php lint. Save file as .git/hooks/pre-commit
#!/bin/bash
# modified from
# https://github.com/ReekenX/git-php-syntax-checker/blob/master/pre-commit
ROOT_DIR="$(pwd)/"
LIST=$(git diff-index --cached --name-only --diff-filter=ACMR HEAD)
ERRORS_BUFFER=""
for file in $LIST
do
EXTENSION=$(echo "$file" | grep ".php$")
@jsgoyette
jsgoyette / build.js
Created November 10, 2012 23:18
Uglify a javascript file.
#!/usr/local/bin/node
var fs = require('fs'),
uglify = require('uglify-js'),
header = function (name) {
return '/*\n * ' + name + '.js ~ Copyright (c) 2012 My Copyright\n */\n';
};
function buildFile() {
var args = Array.prototype.slice.call(arguments);