Skip to content

Instantly share code, notes, and snippets.

View miry's full-sized avatar

Michael Nikitochkin miry

View GitHub Profile
@miry
miry / golang_start.md
Last active December 9, 2016 20:20
Start with Golang
@miry
miry / code_of_the_rings.go
Last active August 29, 2015 14:23
Sample application to encode text to characters of machine turing
package main
import "fmt"
import "os"
import "bufio"
import "strings"
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
@miry
miry / presto_to_graphite.rb
Last active August 29, 2015 14:23
Simple script to send metrics from presto to graphite
#!/usr/bin/env ruby
# Install dependicies:
# gem install graphite-api
# gem install presto-client
# gem install presto-metrics
require 'rubygems'
require 'graphite-api'
require 'presto/metrics'
@miry
miry / mysql2.rb
Created June 24, 2015 16:12
Install chef gem mysql2 with all dependicies
r = mysql2_chef_gem 'default' do
client_version mysql_version
action :nothing
end
r.run_action(:install)
chef_gem 'mysql2'
gem_package 'mysql2' do
action :install
@miry
miry / btsync.service
Created May 20, 2015 18:12
Simple Systemd services for my local server
# create /etc/systemd/system/btsync.service
# systemctl start btsync.service
# systemctl status btsync.service
# systemctl enable btsync.service
[Unit]
Description=BTSync daemon
[Service]
#Type=forking
PIDFile=/run/btsync/btsync.pid
#/usr/bin/bash
for i in `ps ax | awk '{print $1}' | tail -n+2`; do lsof -p $i | grep deleted; done
@miry
miry / 100-honeybadger-deploy.config
Created March 4, 2015 09:39
ElasticBeanstalk Honeybadger deploy notification script: .ebextensions/100-honeybadger-deploy.config
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/01_notify.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
EB_CONFIG_SOURCE_BUNDLE=$(/opt/elasticbeanstalk/bin/get-config container -k source_bundle)
EB_SUPPORT_FILES=$(/opt/elasticbeanstalk/bin/get-config container -k support_files_dir)
# encoding: utf-8
require 'nokogiri'
require 'csv'
def parse_row(row)
result = {}
row.children.each do |el|
next if el.name == 'text'
result[el.name] = el.text.strip
// RUN: go test -run=XXX -bench=. string_con_test.go
// OUTOUT:
/*
PASS
BenchmarkNaiveConact 2000000000 0.64 ns/op
BenchmarkJoinsConact 3000000 432 ns/op
BenchmarkBuffer 3000000 541 ns/op
ok command-line-arguments 5.262s
*/
package main
@miry
miry / main.go
Last active August 29, 2015 14:10
package main
import (
"fmt"
"net/http"
"github.com/HitFox/ad_server/app"
"github.com/HitFox/ad_server/handler/bulk"
"github.com/HitFox/ad_server/mid"
"runtime"