Skip to content

Instantly share code, notes, and snippets.

View dsernst's full-sized avatar
🧘‍♂️
practicing mindfulness

David Ernst dsernst

🧘‍♂️
practicing mindfulness
View GitHub Profile
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active March 1, 2024 14:39
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@dsernst
dsernst / get-city-by-zip.js
Created April 11, 2017 12:51
Translate zip codes into city + state
function getCityByZip(zip) {
fetch(`https://maps.googleapis.com/maps/api/geocode/json?address=${zip}`)
.then(response => response.json())
.then(response => response.results[0].formatted_address)
.then(console.log)
}
@ateucher
ateucher / setup-gh-cli-auth-2fa.md
Last active May 3, 2024 11:06
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global user.name 'Firstname Lastname'
    git config --global user.email 'firstname.lastname@gov.bc.ca'
    

System Design Cheatsheet

Step One: Framing The Problem a.k.a get the MVP

  • Identify the use cases that are in scope
  • Determine constraints based on scoped use cases

use case : the things your system needs to be do.

constraints : the things your system will have to consider to be able to do stuff

@primitive-type
primitive-type / rename-field.js
Created January 21, 2016 23:31
Rename Field (ReQL)
r.db('local').table('TableName')
.replace(function (doc) {
return doc.merge({
newFieldName: doc('oldFieldName')
}).without('oldFieldName');
});
@fcamblor
fcamblor / lodash-3.9.3-appscript.js
Last active November 18, 2020 09:53
Lodash 3.9.3 compat with google appscript
/**
* @license
* lodash 3.9.3 (Custom Build) <https://lodash.com/>
* Build: `lodash modern -o ./lodash.js`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
;(function() {
@jsomers
jsomers / a-wotd-custom-word-list.md
Last active October 23, 2023 20:20
How to use a custom word list with OS X's "Word of the Day" screensaver

OS X's "Word of the Day" screensaver is a great way to passively learn words:

But I've always thought that its word list kind of stunk—it was full of obscure words that I could never really see myself using. I'd prefer something like Norman Schur's 1000 Most Important Words. What if you could plug your own word list into the screensaver?

On a rather obscure comment thread, someone explained where you might find the word list that Apple uses to power the screensaver. It is at /System/Library/Graphics/Quartz\ Composer\ Plug-Ins/WOTD.plugin/Contents/Resources/NOAD_wotd_list.txt. The file looks like this:

m_en_us1282510	quinsy
#!/bin/bash
#===========================================
# pomo2beeminder.sh created 2015.01.25
# https://github.com/gojun077/pomo2beeminder
# Jun Go gojun077@gmail.com
#===========================================
# This script is designed to be launched by xfce4-timer-plugin
# or pystopwatch after a 25-minute pomodoro timer completes.
# The user will be asked whether or not the pomodoro was completed
# successfully (without distractions). If the answer is 'y', the
@masatomo
masatomo / gist:983a84bad9671dc29213
Last active February 28, 2018 08:49
How to use MongoDB 2.6.x on CircleCI (circle.yml)
dependencies:
cache_directories:
- mongodb-linux-x86_64-2.6.4
pre:
- if [[ ! -d mongodb-linux-x86_64-2.6.4 ]]; then wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz && tar xvzf mongodb-linux-x86_64-2.6.4.tgz; fi
- sudo /etc/init.d/mongodb stop
- sudo cp mongodb-linux-x86_64-2.6.4/bin/* /usr/bin
- sudo /etc/init.d/mongodb start

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju