Skip to content

Instantly share code, notes, and snippets.

View andboson's full-sized avatar
🌴

Andrii Bosonchenko andboson

🌴
  • Cherkasy, UKR \ Alicante, SP
View GitHub Profile
insert into questions(article, name, email, text, hash, sale_location_id, created_at, updated_at ) select 1111111 as article, 'drew' as name, 'i@s.com' as email, md5(generate_series(1,10)::text) as text, md5(generate_series(1,10)::text) as hash, 'shop_r002' as sale_location_id, to_date(now()::text, 'YYYY-MM-DD HH:MI:SS') as created_at, to_date(now()::text, 'YYYY-MM-DD HH:MI:SS') as updated_at;
@andboson
andboson / gist:49a7e6b1fdd57389d261
Last active August 29, 2015 14:24
singleton pattern in go
package singleton
import (
"sync"
)
//http://marcio.io/2015/07/singleton-pattern-in-go/
type singleton struct {
}
type FFiltersController struct {
Request *http.Request
Response http.ResponseWriter
}
type inputRequest struct {
Id int `json:"id"`
Url string `json:"url"`
SaleLocationId string `json:"sale_location_id"`
Categories []string `json:"categories"`
'{"url":"/lg-active3D-smart-tv"}'
@andboson
andboson / main.go
Created May 5, 2015 15:10
Beego different configs
............
//another config placed in conf/prod/app.conf
func Init() { //old init()
//something like init database
}
func main() {
if beego.RunMode == "dev" {
@andboson
andboson / .zshrc
Last active August 8, 2019 09:00
GOPATH
export GOPATH=`pwd`
export PATH="$PATH:$GOPATH/bin"
echo -e "\033[0;32m CURRENT GOPATH IS: $GOPATH \e[0m"
alias rp='source ~/.zshrc'
siege -c15 -r2 'http://localhost:8000/api/v1/user_channel.get_sale_location POST {"session_id":"8888888888888", "channel":"MM", "sale_location_id":"shop"}'
@andboson
andboson / xhprof
Created February 3, 2015 15:38
laravel xhprof snip wget http://pecl.php.net/get/xhprof-0.9.4.tgz tar xvf xhprof-0.9.4.tgz php -S localhost:9999
define("XHPROF_ROOT", '/var/www/xhprof-0.9.4');
App::before(function(){
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
});
App::after(function(){
require_once (XHPROF_ROOT . '/xhprof_lib/utils/xhprof_lib.php');
require_once (XHPROF_ROOT . '/xhprof_lib/utils/xhprof_runs.php');
$file = file($usersFile->getPathname());
$header = str_getcsv(array_shift($file));
$usersArray = array_map(function ($line) use ($header) {
$row = str_getcsv($line);
return (object)array_combine($header, $row);
}, $file);
@andboson
andboson / docker works
Last active August 29, 2015 14:13
docker create image manual
sudo docker run -t -i ubuntu:12.04
>do something
Ctrl-p + Ctrl-q
sudo docker ps -a
sudo docker commit 123432423 andboson/ubuntu:12.04.dev
sudo docker images
sudo docker run -t -i andboson/ubuntu:12.04.dev /bin/bash
>do something
Ctrl-p + Ctrl-q
sudo docker ps -a