Skip to content

Instantly share code, notes, and snippets.

View rashkur's full-sized avatar
:octocat:

Roman S rashkur

:octocat:
View GitHub Profile
@rashkur
rashkur / word_country_data.sql
Created March 28, 2018 08:48 — forked from jaconza/word_country_data.sql
MySQL script for creation and population of country, city and countryLanguage tables with the most popular cities and countries already inserted.
-- MySQL dump 10.13 Distrib 5.1.51, for pc-linux-gnu (i686)
--
-- Host: 127.0.0.1 Database: world
-- ------------------------------------------------------
-- Server version 5.1.51-debug-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
@rashkur
rashkur / 1.json
Created March 10, 2018 00:08
java jakson json read subnodes
{
"address" : { "street" : "2940 5th Ave", "zip" : 980021 },
"dimensions" : [ 10.0, 20.0, 15.0 ]
}
@rashkur
rashkur / as.bash
Last active December 19, 2019 10:47
Autonomous system (ASN) lookup
#!/usr/bin/expect
#"AS61119,AS60863,AS51286,AS49988,AS49797,AS47764,AS21051,AS206494,AS47764":"mailru,odnoklassniki", "AS47541,AS47542,AS28709":"vkontakte", "AS43247,AS207207,AS202611,AS13238":"yandex"
set timeout 60
log_user 0
spawn telnet route-server.he.net
foreach as {61119 60863 51286 49988 49797 47764 21051 206494 47764 47541 47542 28709 43247 207207 202611 13238 1} {
expect {
"route-server> " {
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.trace_enable_trigger=1
xdebug.trace_output_dir=/var/traces
xdebug.collect_params=4
xdebug.overload_var_dump=0
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir=/var/profiles
mkdir /var/{traces,profiles}
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.trace_enable_trigger=1
xdebug.trace_output_dir=/var/traces
xdebug.collect_params=4
xdebug.overload_var_dump=0
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir=/var/profiles
@rashkur
rashkur / keybase.md
Last active May 12, 2017 02:14
keybase.md

Keybase proof

I hereby claim:

  • I am rashkur on github.
  • I am rashkur (https://keybase.io/rashkur) on keybase.
  • I have a public key ASDuU7_KlnHUUJeCdNA4fXxsdPavMZnzZSy5YiwdwqWexAo

To claim this, I am signing this object:

@rashkur
rashkur / mongodb_collection_sizes.js
Last active October 7, 2016 16:20 — forked from joeyAghion/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
function getReadableFileSizeString(fileSizeInBytes) {
var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
do {
fileSizeInBytes = fileSizeInBytes / 1024;
i++;
} while (fileSizeInBytes > 1024);
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
@rashkur
rashkur / post-receive
Last active November 26, 2015 11:11
update remote nginx configs from gitlab hook
...
if repo_path.include? "YOUR_REPO.git"
system('/some/path/update-front.sh')
end
...
import urllib2, simplejson as json
manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
manager.add_password(None, 'https://robot-ws.your-server.de', 'login', 'password')
handler = urllib2.HTTPBasicAuthHandler(manager)
opener = urllib2.build_opener(handler)
def get_rdns(addr):
try:
rdns = opener.open('https://robot-ws.your-server.de/rdns/'+addr)
@rashkur
rashkur / buildgraph.sh
Last active August 29, 2015 14:26
build png from nginx access log
#!/bin/bash
FILE=$1
FDATE=$(head -1 $FILE |awk '{print $4}'|sed -e 's/\[//'|sed -e 's/\//-/g'|sed -e 's/:/ /')
FDATE_S=$(date -d "$FDATE" '+%s');
FDATE_T=$((FDATE_S + 3600));
COUNT=0
DATAFILE=$(mktemp)