Skip to content

Instantly share code, notes, and snippets.

View MadFaill's full-sized avatar

Nikolay MadFaill

View GitHub Profile
@MadFaill
MadFaill / app.php
Created October 6, 2015 21:50
Прикручивание Donctrine ORM к сайлекс без сервиса
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/boot.php';
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Synfony\Component\HttpFoundation\Response;
$app = new Application();
@MadFaill
MadFaill / silex-sf2-controllers.rst
Created October 9, 2015 23:55 — forked from kix/silex-sf2-controllers.rst
How to use controllers like in Symfony2 framework

How to use controllers like in Symfony2 framework

In Silex, the most common way to define the controller of a route is with a closure. But when your project gets bigger, you want to organize your code in classes. You can use the syntax ClassName::methodName in your route definition instead of a function () { ... } but you have to inject the Silex\Application $app as a parameter on each method of your controller class, which can become quite boring.

@MadFaill
MadFaill / echo.go
Created January 22, 2016 17:50 — forked from paulsmith/echo.go
A simple echo server testing a few interesting Go language features, goroutines and channels.
// $ 6g echo.go && 6l -o echo echo.6
// $ ./echo
//
// ~ in another terminal ~
//
// $ nc localhost 3540
package main
import (
@MadFaill
MadFaill / chat.go
Created April 18, 2016 15:30
simple golang chat server
package main
import (
"bufio"
"net"
)
type Client struct {
incoming chan string
outgoing chan string
@MadFaill
MadFaill / Gogs-Docker.adoc
Created April 20, 2016 06:55 — forked from mgreau/Gogs-Docker.adoc
Gogs Docker Env (docker-compose)

Replace 192.168.99.100 by your DOCKER_HOST IP

# Configure the server
curl 'http://192.168.99.100:3000/install' \
  -H 'Origin: null' -H 'Accept-Encoding: gzip, deflate' \
  -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' \
  -H 'Upgrade-Insecure-Requests: 1' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36' \
@MadFaill
MadFaill / supervisor.conf
Created May 20, 2016 17:22 — forked from tsabat/supervisor.conf
Sample supervisor config file
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
@MadFaill
MadFaill / enc_dec.go
Created January 22, 2017 08:33 — forked from myouju/enc_dec.go
encryption - ruby, python and golang with AES-256-CFB and
package main
import (
"fmt"
"io"
"encoding/base64"
"crypto/rand"
"crypto/cipher"
"crypto/aes"
"crypto/md5"
@MadFaill
MadFaill / orhttp_example.go
Created January 23, 2017 04:06 — forked from Yawning/orhttp_example.go
How to dispatch HTTP requests via Tor in Go.
// 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"
@MadFaill
MadFaill / proxy.go
Created January 24, 2017 07:03 — forked from vmihailenco/proxy.go
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
@MadFaill
MadFaill / proxy.go
Created January 24, 2017 19:01 — forked from ericflo/proxy.go
Golang TCP Proxy
package proxy
import (
"io"
"net"
"sync"
log "github.com/Sirupsen/logrus"
)