Skip to content

Instantly share code, notes, and snippets.

View sourcec0de's full-sized avatar
:octocat:
Focusing

James R Qualls sourcec0de

:octocat:
Focusing
View GitHub Profile
@sourcec0de
sourcec0de / proxy.go
Created August 13, 2016 19:47 — forked from montanaflynn/proxy.go
Golang reverse proxy
package main
import (
"log"
"net/http"
"net/http/httputil"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
import _ from 'lodash'
import crypto from 'crypto'
import urllib from 'url'
import querystring from 'querystring'
const SignedHeaders = 'content-type;host;x-hyper-content-sha256;x-hyper-date'
const HeaderContentHash = 'X-Hyper-Content-Sha256'
const Algorithm = 'HYPER-HMAC-SHA256'
const Region = 'us-west-1'
const Service = 'hyper'
@sourcec0de
sourcec0de / dont-store-sessions-in-redis.md
Last active August 31, 2023 07:43
Why I choose not to store sessions in redis.

Why I don't use redis as a session store

You can never rely on a system to be online 100% of the time. It's just the ephemeral nature of computing. Inevitably things break and shit happens.

My primary reasons for not using redis

  • Increased tail latency by adding network overhead (yes redis is fast but you're still using the network)
  • If you run a slow operation it will slow down all other queries (SORT, LREM, SUNION)
  • this is because redis is single threaded
@sourcec0de
sourcec0de / token.md
Created March 25, 2016 16:23
Generate github token with url
https://github.com/settings/tokens/new?scopes=repo&description=Your+awesome+description
@sourcec0de
sourcec0de / tmux-cheatsheet.markdown
Created January 30, 2016 21:49 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@sourcec0de
sourcec0de / html-core.md
Created December 7, 2015 15:50
All core html elements. This is a shortened version of https://developer.mozilla.org/en-US/docs/Web/HTML/Element

Content sectioning

Content sectioning elements allow you to organize the document content into logical pieces. Use the sectioning elements to create a broad outline for your page content, including header and footer navigation, and heading elements to identify sections of content.

Element Description
<address> supplies contact information
<article> represents a self-contained composition in a document
<footer> represents a footer for its nearest sectioning content or sectioning root element. A footer typically contains information about the author of the section, copyright data or links to related documents.
`` represents a group of introductory or navigational aids
@sourcec0de
sourcec0de / docker-compose-coreos.sh
Created November 30, 2015 19:39
Install docker compose on coreos
sudo su -
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.5.1/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
#!/bin/bash
sudo apt-get update
sudo apt-get -y install linux-image-extra-$(uname -r)
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get -y install lxc-docker
_____________________________________
/ TYOLOONTYOLO: To YOLO or not to YOLO, \
| especially as it relates to large |
| production deployments at 6PM on a |
\ Friday. /
-------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |