start new:
tmux
start new with session name:
tmux new -s myname
| package main | |
| import ( | |
| "encoding/hex" | |
| "log" | |
| "net" | |
| "time" | |
| ) | |
| const ( |
| // package spooler implements a disk-persistent queue. | |
| // | |
| // Spooler uses MDB (LMDB) to implement a queue of byteslices. Its intended usecase | |
| // is to enqueue work items received by a service before later working them off. | |
| // Note that Spooler only flushes to disk up to once every 25ms. As a result, | |
| // if the process or machine crashes unexpectedly, the most recent 25ms of work | |
| // can be lost. This decision effectively increases throughput by 10,000%, | |
| // but makes spooler unsuitable for jobs that absolutely cannot be allowed to fail | |
| // under any circumstances. | |
| package spooler |
| 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' |
| #!/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 |
| type Whatever struct { | |
| someField int | |
| } | |
| func (w Whatever) MarshalJSON() ([]byte, error) { | |
| return json.Marshal(struct{ | |
| SomeField int `json:"some_field"` | |
| }{ | |
| SomeField: w.someField, | |
| }) |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| var net = require('net') | |
| var sock = net.connect(1337) | |
| process.stdin.pipe(sock) | |
| sock.pipe(process.stdout) | |
| sock.on('connect', function () { | |
| process.stdin.resume(); | |
| process.stdin.setRawMode(true) |
| /* | |
| * Copyright (c) 2010 Tobias Schneider | |
| * This script is freely distributable under the terms of the MIT license. | |
| */ | |
| (function(){ | |
| var UPC_SET = { | |
| "3211": '0', | |
| "2221": '1', | |
| "2122": '2', |