A running example of the code from:
- http://marcio.io/2015/07/handling-1-million-requests-per-minute-with-golang
- http://nesv.github.io/golang/2014/02/25/worker-queues-in-go.html
Small refactorings made to original code:
A running example of the code from:
Small refactorings made to original code:
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
func handleUpload(u io.Reader) (err error) { | |
// capture all bytes from upload | |
b, err := ioutil.ReadAll(u) | |
if err != nil { | |
return | |
} | |
// wrap the bytes in a ReadSeeker | |
r := bytes.NewReader(b) |
Full-page background made with JavaScript and Canvas: the animation follows movement on non-touch devices
Forked from Marco Guglielmelli's Pen Animated Background.
// To the extent possible under law, the Yawning Angel has waived all copyright | |
// and related or neighboring rights to orhttp_example, using the creative | |
// commons "cc0" public domain dedication. See LICENSE or | |
// <http://creativecommons.org/publicdomain/zero/1.0/> for full details. | |
package main | |
import ( | |
// Things needed by the actual interface. | |
"golang.org/x/net/proxy" |
ls -la | |
echo "hello" | |
tree | |
adb devices | |
adb wait-for-device #example of a long running task |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
<?php | |
/** | |
* PHP XML to dynamic table | |
* | |
* @link http://stackoverflow.com/q/16997835/367456 | |
*/ | |
require('.../Iterator-Garden/src/autoload.php'); // for DecoratingIterator - use development branch | |
#! /usr/bin/env php | |
<?php | |
/* PHP Slowloris | |
* Adapted from the script found here: http://seclists.org/fulldisclosure/2009/Jun/207 | |
* Contains get based attack (slow headers) and post based attack (long content length) | |
* | |
* Author: Seppe vanden Broucke | |
*/ | |
function usage($argv){ |