Skip to content

Instantly share code, notes, and snippets.

View myobie's full-sized avatar

Nathan myobie

View GitHub Profile
@myobie
myobie / now.yml
Last active January 7, 2020 14:50
Zeit's now preview and prod deploy Actions Workflow – emulates how Zeit's Now GitHub integration works, but is even better because it forces a rebuild even if the source code hasn't changed
name: now
on:
push:
jobs:
deploy-prod:
name: Deploy prod
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
@dbi
dbi / edit.html.mustache
Created May 4, 2011 09:31
Rails form helper for mustache spike/proof of concept
<!-- A scaffolded edit view converted to mustache -->
<h1>Editing post</h1>
{{#form}}
{{#errors?}}
<div id="error_explanation">
<h2>{{error_header}}</h2>
</div>
<ul>
@jonathan-beebe
jonathan-beebe / vundle_swift_vim_instructions.md
Last active November 30, 2021 16:24
Using Apple’s Swift vim plugin with Vundle

Source of original vim config: https://github.com/apple/swift/tree/master/utils/vim

# use `svn checkout…` to grab just the subfolder from github
svn checkout https://github.com/apple/swift/trunk/utils/vim
# rename to something a bit more specific
mv vim vim-swift
cd vim-swift
rm -rf .svn
# init git
@nazgob
nazgob / ctags.setup
Created January 6, 2012 13:44
ctags setup on mac
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"
@jessedearing
jessedearing / gist:2351836
Created April 10, 2012 14:44 — forked from twoism-dev/gist:1183437
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
@kez
kez / slugify.sql
Created May 13, 2019 14:50 — forked from ianks/slugify.sql
Generating Slugs in Postgres
CREATE EXTENSION IF NOT EXISTS "unaccent"
CREATE OR REPLACE FUNCTION slugify("value" TEXT)
RETURNS TEXT AS $$
-- removes accents (diacritic signs) from a given string --
WITH "unaccented" AS (
SELECT unaccent("value") AS "value"
),
-- lowercases the string
"lowercase" AS (
@jboner
jboner / latency.txt
Last active May 6, 2024 07:06
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD