Skip to content

Instantly share code, notes, and snippets.

@yaru22
yaru22 / main.go
Created January 8, 2018 01:47 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@yaru22
yaru22 / osx-for-hackers.sh
Created July 18, 2016 19:27 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@yaru22
yaru22 / latency.txt
Created June 7, 2016 14:54 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
@yaru22
yaru22 / path.js
Last active August 29, 2015 14:17 — forked from abidibo/path.js
// requires mootools selectors
var path = function path(element) {
if(element.get('id')) {
return '#' + element.get('id');
}
if(element == document.body) {
return 'body';

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

// Use: var tree = new OST(); tree.select(4); tree.insert(key,value)
var OST = function () {
// Order statistic tree node
var Node = function (leftChild, key, value, rightChild, parent) {
return {
leftChild: (typeof leftChild === "undefined") ? null :
leftChild,
key: (typeof key === "undefined") ? null : key,
value: (typeof value === "undefined") ? null : value,
rightChild: (typeof rightChild === "undefined") ? null :
@yaru22
yaru22 / gist:5024427
Created February 24, 2013 16:27
Minimal TinyMCE Setup
<script src='path-to-tinymce-folder/tiny_mce.js'></script>
<textarea id='textArea1' style='width:100%'>
<p><h2>TinyMCE is so easy to setup!</h2></p>
</textarea>
<script>
tinyMCE.init({
mode: 'exact', // converts elements of the specified names as listed in the elements option into the rich text editor
elements: 'textArea1'