View file.go
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 list []*item | |
// Work | |
for g := range *list { | |
z := *list | |
println(z[g].Name) | |
} | |
// Fail | |
for g := range *list { |
View api-server.go
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 ( | |
"github.com/google/jsonapi" | |
"github.com/labstack/echo" | |
"net/http" | |
) | |
type Album struct { | |
ID int `jsonapi:"primary,albums"` |
View gist:fff2592ec38e5d9798d0
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
Note that that test[] is squashed | |
$ http --form -f PUT http://127.0.0.1/api/post/ZDqojJqaYumqxJKzXUvB7Y author='author' content='content' title='title' test[]='ffff' test[]='zzzz' file@~/Pictures/Screenshot\ from\ 2015-09-13\ 17-12-02.png | |
HTTP/1.1 200 OK | |
Connection: keep-alive | |
Content-Encoding: gzip | |
Content-Type: text/html; charset=UTF-8 | |
Date: Tue, 09 Feb 2016 19:42:48 GMT | |
Server: nginx/1.9.7 |
View test_perform_bug_on_unique_column.sql
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
DROP TABLE test; | |
SELECT * FROM test; | |
CREATE TABLE test ( | |
id SERIAL, | |
name TEXT | |
); | |
INSERT INTO test (name) VALUES ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h'); |
View gist:9567af68d09e8597cc82
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
# Few steps to setup Skype as a docker | |
# Might be over complicated as I did it back at Oct 2014 when I just started with docker (but it still works well) | |
https://registry.hub.docker.com/u/tomparys/skype/ | |
# Create Skype container | |
# Insure .Skype exist in the home dir | |
sudo docker run --name skype -d -p 55555:22 -v /home/miki/.Skype:/home/docker/.Skype tomparys/skype |
View gist:6782ec00afe8addfe480
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
$this->add(array( | |
'name' => 'name', | |
'options' => [ | |
'label' => 'Garden Name', | |
'attributes' => [ | |
'class' => 'col-lg-2 col-sm-2 control-label', | |
], | |
], | |
'attributes' => [ | |
'class' => 'form-control', |
View gist:d1b26269ff24947f6376
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
https://registry.hub.docker.com/u/tomparys/skype/ | |
# Create Skype container | |
# Insure .Skype exist in the home dir | |
sudo docker run --name skype -d -p 55555:22 -v /home/miki/.Skype:/home/docker/.Skype tomparys/skype | |
ssh-keygen -t rsa -C "Just for skype" | |
$ cat .ssh/config |
View gist:7ea2f627de4b2220dc18
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
<?php | |
/** | |
* Delete an entity from the global identity map and all other queues | |
* @param AbstractDomainEntity $entity | |
*/ | |
static public function unRegister(AbstractDomainEntity $entity) | |
{ | |
$instance = self::getInstance(); | |
$instance->registerClean($entity); | |
unset($instance->all[$instance->globalKey($entity)]); |
View gist:0d6ff5cb217c36419661
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
# Ubuntu 14.04 don't have nsenter - the straight forward way required me to install build tools and etc. | |
# I preferred to keep the system clean and install nsenter in a container and then copy the command to the host | |
# Note - its also possible to run nsenter from a container (didn't tried) https://github.com/jpetazzo/nsenter | |
# start a container | |
docker run --name nsenter -it ubuntu:14.04 bash | |
## in the docker | |
apt-get update | |
apt-get install git build-essential libncurses5-dev libslang2-dev gettext zlib1g-dev libselinux1-dev debhelper lsb-release pkg-config po-debconf autoconf automake autopoint libtool |
View gist:2da49be6534e1fdb16aa
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
On host 1 | |
nc -v -l 2222 > /dev/null | |
On host 2 | |
dd if=/dev/zero bs=1024K count=30720 | nc -v 10.0.26.132 2222 |