Skip to content

Instantly share code, notes, and snippets.

View sitano's full-sized avatar

Ivan Prisyazhnyy sitano

View GitHub Profile
@sitano
sitano / io-load-test-16k.sh
Created August 19, 2014 15:15
sysbench async iops 50gb test for RDBS (16k x 8io x async x direct x 64split x rndrw)
sz=50G
sysbench --test=fileio --file-total-size=$sz --file-num=64 prepare
sysbench --test=fileio --file-total-size=$sz --file-test-mode=rndwr --max-time=180000 --max-requests=0 --num-threads=8 --rand-init=on --file-num=64 --file-io-mode=async --file-extra-flags=direct --file-fsync-freq=0 --file-block-size=16384 --report-interval=10 run
@sitano
sitano / jvm-bootstrap.sh
Last active August 29, 2015 14:05
JVM bootstrap script
#!/bin/bash
# The MIT License (MIT)
# Copyright (c) 2014 Ivan Prisyazhniy <john.koepi@gmail.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@sitano
sitano / rebuild.sh
Created August 29, 2014 11:18
hg, fpm, prm, virtualenv rebuild deb package script
#!/bin/bash
# The MIT License (MIT)
# Copyright (c) 2014 Ivan Prisyazhniy <john.koepi@gmail.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@sitano
sitano / rust_file_copy_test.rs
Last active August 29, 2015 14:20
Sample file copy / temp / creation in RUST (1.0.0-beta2)
#[allow(unused_imports)]
use std::io;
use std::path::Path;
use std::fs::File;
type IoResult<T> = std::io::Result<T>;
extern crate tempdir;
extern crate rustc_serialize;
extern crate docopt;
@sitano
sitano / glog-rotate.sh
Last active August 29, 2015 14:21
glog rotation + gzip
#!/bin/bash
NAME="service"
LIMIT="8000"
DELETELIMIT="500"
# Packing
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) && cd $DIR
FILES=`ls -A1Lct ${NAME}.* | grep -v '.sh$' | grep -v '.zip$' | grep -v '.gz$'`
TYPES=`echo "$FILES" | grep -E '.[A-Z]+$' | wc -l`
@sitano
sitano / consul.wan.join.sh
Created May 18, 2015 13:09
Consul 0.4.x startup WAN reconnect script
#!/bin/bash
. /etc/environment
PUBLIC_IPV4=`cat /etc/network/interfaces | grep -A 2 'iface eth0' | head -n +2 | tail -n 1 | awk '{print $2}'`
PRIVATE_IPV4=`cat /etc/network/interfaces | grep -A 2 'iface eth1' | head -n +2 | tail -n 1 | awk '{print $2}'`
SERVERS=(DATACENTER1 DATACENTER2 DATACENTER3)
for SERVER in "${SERVERS[@]}"; do
curl http://${PRIVATE_IPV4}:8500/v1/agent/join/${SERVER}.mysupercompany.com:8302?wan=1
@sitano
sitano / gist:a9260aac7bd40bc5310b
Created May 25, 2015 10:41
diff for github.com/cznic/ql, issue99_test, a8fb57c..cb5e47f
diff --git a/issue99_test.go b/issue99_test.go
index a8fb57c..cb5e47f 100644
--- a/issue99_test.go
+++ b/issue99_test.go
@@ -10,6 +10,8 @@ import (
"strconv"
"strings"
"sync"
+ "time"
+ "fmt"
@sitano
sitano / gist:bed03bc66f56a71570a5
Last active August 29, 2015 14:22
modified fibonacci, O(n^1.58), Karatsuba algorithm, Fast SQR = (x*b + y)^2, where len(x) = len(y) +/- 1
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
#define assert(x) ((void)(!(x) && (cout << "ERROR: at " << __FILE__ << ":" << __LINE__ << " " << #x << endl)))
@sitano
sitano / nginx.conf
Last active August 29, 2015 14:25
openrusty nginx lua http traffic replication with multiple capture example
worker_processes 2;
events {
worker_connections 1024;
}
http {
access_log /dev/stderr combined;
keepalive_timeout 65;
@sitano
sitano / redis-server.conf
Created July 30, 2015 09:24
redis-server simple upstart script
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 3 5
kill timeout 10
limit nofile 65535 65535
setuid redis