Skip to content

Instantly share code, notes, and snippets.

Patrick patricksimpson

Block or report user

Report or block patricksimpson

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
View gist:717b92bae64b1318b669758f1175c532
"name": "test",
"version": "1.0.0",
"description": "Hello.",
"main": "index.js",
"scripts": {
"cachebust": "cachebust"
"author": "",
"license": "ISC",
View backup-script
#!/usr/bin/env ruby
$prefix = ''
$host = 'rsync'
$repo = 'laptop'
# Where the snapshot will be mounted.
$mount = "#{Dir.home}/borg"
$ref_file = "#{Dir.home}/.borg-snapshot"
# Define exclusions here.
$exclude_file = "#{Dir.home}/.borg-exclude.txt"
View add.js
function add(x, y) {
while (y != 0) {
carry = x & y;
x = x ^ y;
y = carry << 1;
return x;

Data Structures

Linked List

  • A Linked List is a linear collection of data elements, called nodes, each pointing to the next node by means of a pointer. It is a data structure consisting of a group of nodes which together represent a sequence.
  • Singly-linked list: linked list in which each node points to the next node and the last node points to null
  • Doubly-linked list: linked list in which each node has two pointers, p and n, such that p points to the previous node and n points to the next node; the last node's n pointer points to null
  • Circular-linked list: linked list in which each node points to the next node and the last node points back to the first node
  • Time Complexity:
    • Access: O(n)
patricksimpson / carExpert.js
Last active Feb 13, 2019
Car Expert - Decision Tree
View carExpert.js
* key: 'unqiue_key'
question: 'string',
responses: [{
response: 'positive',
answer: 'battery_terminal'
const carExpert = [{
key: 'start',
patricksimpson / static-search.js
Created Jan 14, 2019
A little search for static sites, using Lunr.js!
View static-search.js
(function() {
if (window.fetch) {
let searchPage = document.querySelector('.search-body');
if (searchPage) {
let addLunr = document.createElement('script');
addLunr.src = '/static/js/lunr.js';
addLunr.onload = function() {
fetch('/lunr.json').then(function(response) {
return response.json();

Keybase proof

I hereby claim:

  • I am patricksimpson on github.
  • I am patricksimpson ( on keybase.
  • I have a public key ASBhv__xF1M8Vi8U7sqEiLz5uVBSlopVhbY8oGlmIG_BSQo

To claim this, I am signing this object:

View debug-server.txt
uptime # uptime and CPU stress
w # or better yet:last |head # who is/has been in
netstat -tlpn # find server role
df -h # out of disk space?
grep kill /var/log/messages # out of memory?
keychainItem=vpn # this name has to match "Account" for the entry you make in keychain
VPNName="" # match the name of the VPN service to run
function isnt_connected () {
scutil --nc status "$VPNName" | sed -n 1p | grep -qv Connected
get_pw () {
security 2>&1 >/dev/null find-generic-password -ga $keychainItem \
patricksimpson / module.js
Last active Dec 10, 2019
JavaScript Design Patterns
View module.js
var options = {
username: 'blah',
server: ''
var ConfigObject = (function(params) {
var username = params.username || '',
server = params.server || '',
password = params.password || '';
You can’t perform that action at this time.