Skip to content

Instantly share code, notes, and snippets.

View jordic's full-sized avatar
🐛
python

Jordi Collell jordic

🐛
python
  • https://tmpo.io
  • Barcelona, ES
View GitHub Profile
@jordic
jordic / Dockerfile
Last active November 4, 2015 13:26
3DES_crypt
FROM php:5.6-cli
RUN apt-get update && apt-get install -y libmcrypt-dev \
&& docker-php-ext-install mcrypt
CMD ["php"]
@jordic
jordic / template.sh
Created November 19, 2015 06:46
Bash template variable
# 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\""
}
@jordic
jordic / goproxy.go
Created December 3, 2015 05:41
go proxy
/*
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)
@jordic
jordic / levels.txt
Created March 9, 2013 08:51
levels.txt
Akelael: 8
ChalsBcn: 8
fernand0: 8
fordperfect: 8
hexus: 8
JagerMeister: 8
Killori: 8
Mulworth: 8
piti: 8
Regor: 8
@jordic
jordic / untar
Created June 23, 2016 05:10
Create a multitar archive
# 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
(function(){
angular.module('mnt')
.directive('tTimer', function() {
return {
template: [
'<div class="tpreload">',
' <div style="width:{{$ctrl.percent}}%"></div>',
'</div>'
].join("\n"),
package client
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
@jordic
jordic / factory.ts
Created September 27, 2016 06:28
factory ts
abstract class Model {
cuack(m:string):void {
console.log("Hey", m);
}
}
class Result {
getModelType<c extends Model>(type:{new():c}, p:string):c {
return new type();
}
@jordic
jordic / limiter.go
Created October 3, 2016 13:20
golang request limiter
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// type Limiter struct {
@jordic
jordic / Caddyfile
Created October 14, 2016 08:10
Caddyfile for html5 sap
localhost:2000
tls self_signed
gzip
rewrite {
to {path} {path}/ /index.html
}
root ./dist