Skip to content

Instantly share code, notes, and snippets.

{
"name": "test",
"version": "1.0.0",
"description": "Hello.",
"main": "index.js",
"scripts": {
"cachebust": "cachebust"
},
"author": "",
"license": "ISC",
#!/usr/bin/env ruby
$prefix = 'com.apple.TimeMachine.'
$host = 'rsync'
$repo = 'laptop'
# Where the snapshot will be mounted.
$mount = "#{Dir.home}/borg"
$ref_file = "#{Dir.home}/.borg-snapshot"
# Define exclusions here.
# https://borgbackup.readthedocs.io/en/latest/usage/help.html#borg-help-patterns
$exclude_file = "#{Dir.home}/.borg-exclude.txt"
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
patricksimpson / carExpert.js
Last active February 13, 2019 18:10
Car Expert - Decision Tree
/*
* key: 'unqiue_key'
question: 'string',
responses: [{
response: 'positive',
answer: 'battery_terminal'
}],
*/
const carExpert = [{
key: 'start',

Keybase proof

I hereby claim:

  • I am patricksimpson on github.
  • I am patricksimpson (https://keybase.io/patricksimpson) on keybase.
  • I have a public key ASBhv__xF1M8Vi8U7sqEiLz5uVBSlopVhbY8oGlmIG_BSQo

To claim this, I am signing this object:

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
patricksimpson / fix-mysql-5-7
Created February 23, 2017 16:13
fix mysql 5.7 on macos serria
If you have installed mysql 5.7 using homebrew, on macos serria
Edit your file ~/.my.cnf ( If it does not exist, create it. )
Add the following lines:
[mysqld]
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Save and exit the file.
int led = D0;
void setup() {
// This part is mostly the same:
pinMode(led,OUTPUT); // Our LED pin is output (lighting up the LED)
Particle.subscribe("opendoor", myOpen);
Particle.subscribe("closedoor", myClose);
digitalWrite(led, HIGH);
delay(2500);