This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// based on gist | |
// https://gist.github.com/ir4y/11146415 | |
// http://stackoverflow.com/questions/21417223/simple-ssh-port-forward-in-golang | |
import ( | |
"code.google.com/p/go.crypto/ssh" | |
"code.google.com/p/gopass" | |
"fmt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"github.com/bmizerany/pat" | |
"html/template" | |
"log" | |
"net/http" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ResponseWriterWatcher struct { | |
rw http.ResponseWriter | |
Status int | |
Size int | |
} | |
func WatchResponseWriter(rw http.ResponseWriter) *ResponseWriterWatcher { | |
return &ResponseWriterWatcher{ | |
rw: rw, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
c = function() {} | |
c.prototype.d = {} | |
a = new c() | |
b = new c() | |
a.d.test = 'a' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:5.6-cli | |
RUN apt-get update && apt-get install -y libmcrypt-dev \ | |
&& docker-php-ext-install mcrypt | |
CMD ["php"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tpl is a variable only template parser for bash. | |
tpl() { | |
if [ -z "$1" ]; then | |
echo "Must provide a tpl name: tpl tplname" | |
exit; | |
fi | |
TPL=$(cat $1) | |
eval "echo \"$TPL\"" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
url1, _ := url.Parse("https://www.google.es") | |
url2, _ := url.Parse("http://www.mon.cat") | |
a := &proxy{ | |
entry: map[string]*httputil.ReverseProxy{ | |
"google": httputil.NewSingleHostReverseProxy(url1), | |
"mon": httputil.NewSingleHostReverseProxy(url2), | |
}, | |
} | |
http.Handle("/", a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create | |
tar czpvf - /path/to/archive | split -d -b 100M - tardisk | |
# Decompress | |
cat tardisk* | tar xzpvf - | |
# http://superuser.com/questions/290986/how-to-create-tar-archive-split-into-or-spanning-multiple-files | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
angular.module('mnt') | |
.directive('tTimer', function() { | |
return { | |
template: [ | |
'<div class="tpreload">', | |
' <div style="width:{{$ctrl.percent}}%"></div>', | |
'</div>' | |
].join("\n"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package client | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"net/url" |