Skip to content

Instantly share code, notes, and snippets.

View hhsnopek's full-sized avatar
Working from home

Henry Snopek hhsnopek

Working from home
View GitHub Profile
@hhsnopek
hhsnopek / ncspot-config.toml
Last active September 6, 2021 16:29
Personal (Vim) Keybindings for NCSpot: https://github.com/hrkfdn/ncspot
[keybindings]
"+" = ""
"." = ""
"<" = ""
">" = ""
"A" = ""
"Backspace" = ""
"Ctrl+a" = ""
"Ctrl+e" = ""
"Ctrl+n" = ""
@hhsnopek
hhsnopek / pycrpto-gmp.h.md
Last active January 28, 2019 14:46
Pycrypto `include gmp.h` error

When installing pycrypto on OSX you must install gmp via homebrew and add the CFLAGS for the build to succeed.

$ brew install gmp
$ export "CFLAGS=-I/usr/local/include -L/usr/local/lib"
$ pip2 install pycrypto
@hhsnopek
hhsnopek / package.json
Last active August 30, 2018 19:02
Timeline
{
"name": "timeline",
"version": "0.0.2",
"main": "timeline.js",
"dependencies": {
"date-fns": "^1.29.0"
}
}

Post Requst.

Payload

{
	"data": {
		"type": "users",
		"attributes": {
			"name": "Henry Snopek",
			"email": "hhsnopek@gmail.com",
@hhsnopek
hhsnopek / DNS-migrating.md
Created March 3, 2017 22:27
The trick with migrating a live site is all in DNS timing.

Specifically, we can't provision an SSL certificate until the TTL value has expired from your old values to us, and the new values for us must be correct

  • You must use a CNAME or an A/ALIAS/ANAME record pointing to one of our IP addresses, preferably our Load balancer at 104.198.14.52

So, to do a minimal downtime migration, here are the steps:

  1. find your old TTL value for the record(s) pointing to your old provider. You can find this with a command like dig yoursite.com. In the output, you'll see a line like yoursite.com. X IN A 12.3.4.5 in which the X is your current TTL in seconds. Do this for each hostname you will migrate to us (perhaps sitename.com and www.sitename.com?)

  2. For each of those records, set a low TTL value for all existing records pointing to your old provider - I suggest a value of 10. Do not yet update the values (IP address or hostname) to use our service!

  3. wait for your prior TTL value ("X" in line 1) to pass, while your records still point to your old provider. If you have

@hhsnopek
hhsnopek / perf.sh
Last active January 7, 2017 17:14
Bash Performance Test - Regex vs If/Else
# Requires: `bc`, `bash 4+`
#
# Example Output:
# Iterations 100,000
# regex: 34.570s
# if/else: 18.044s
#
# if/else is 47.8% faster than regex
declare -a arr=("/ock"
@hhsnopek
hhsnopek / spike-fn.md
Last active November 14, 2016 21:18
Remove _cache for hardsource when using spike

Add this to your .bashrc...

This updates the spike call in a couple ways:

  1. if spike is found in the node_modules directory of the pwd, it will use that "local" version of spike rather than the global version
  2. adds spike clean all to remove _cache when that directory is present in pwd
# make your node_modules first class
spike() {
@hhsnopek
hhsnopek / climate.vim
Created October 20, 2016 01:28
a colorscheme based on language syntax
" climate - a colorscheme based on language syntax
"
" color is dependent on the language definition.
" ex: consts cannot change, therefore they're 'frozen' and result in a blue
" color. Unlike vars which can change in value have a resulting red color.
" While the assigning values and comments stay neutral in color.
@hhsnopek
hhsnopek / netlify-dns.md
Last active November 30, 2019 14:48
Netlify DNS setup

Netlify DNS Setup

Quick ref for Netlify custom domains

Records

CNAME

Host: www, Value: you-netlify-site.netlify.com, TTL: 30 min

A

Host: @, Value: 198.61.251.14, TTL: 30min

@hhsnopek
hhsnopek / mapbox-notes.md
Last active September 14, 2016 15:13
TL;DR - Mapbox on a single page