Skip to content

Instantly share code, notes, and snippets.

View jenikm's full-sized avatar

Eugene Magdel jenikm

View GitHub Profile
@jenikm
jenikm / vba_russian_transliterate.vb
Created June 29, 2012 19:44
VBA Russian transliterate function
'http://www.utf8-chartable.de/unicode-utf8-table.pl?start=1024&utf8=-&unicodeinhtml=dec
'use numerical HTML column
Function Transliterate(Russian As String)
letters = Array("A", "B", "V", "G", "D", "E", "YO", "ZH", "Z", "I", "Y", "K", "L", "M", "N", "O", "P", "R", "S", "T", "U", "F", "H", "TZ", "CH", "SH", "SCH", "", "Y", "", "E", "YU", "YA", "a", "b", "v", "g", "d", "e", "yo", "zh", "z", "i", "y", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", "f", "h", "tz", "ch", "sh", "sch", "", "y", "", "e", "yu", "ya", "#")
i = 1040
For Each letter In letters
Dim val As String
Select Case letter
Case "YO"
val = ChrW(1025)
@jenikm
jenikm / post-commit
Last active December 19, 2015 06:39
Create pull requests, respond to code reviews, and reassign pull requests directly from commit messages
#!/usr/bin/env ruby
DEFAULT_ASSIGN_TO = "efrankfurt"
REPO = "BayRu/bayru_rails"
def get_branch
branch = `git branch`.split("\n").map(&:strip).select{|c| c =~ /^\*/}.first.gsub(/[\*\s]*/, '')
end
def determine_pull_request(client)
@jenikm
jenikm / gist:6023484
Created July 17, 2013 19:06
Add your keys to bunch of servers
for i in server_name; do cat ~/.ssh/id_rsa.pub | ssh username@$i.hostname.com "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"; done
@jenikm
jenikm / .gitconfig
Last active December 20, 2015 04:49
Git config
[alias]
fetch-tags = fetch --tags origin
co = checkout
ci = commit
stat = status
lg = log -p
br = branch
resolved = add
update = remote update
amend = commit --amend
@jenikm
jenikm / cleanup_amazon_downloaded_resports
Created July 25, 2013 20:32
Cleanup old reports in amazon account: https://www.amazon.com/gp/b2b/reports?ie=UTF8&ref_=ya_order_reports Keeps top 4 most recent reports
jQuery("input[name='reportID']").each(function(i){if(i>=4){jQuery.ajax({ type: "POST", url: "https://www.amazon.com/gp/b2b/reports/delete-report", data: "reportID=" + this.value + "&delete-report.x=6&delete-report.y=7"})};})
@jenikm
jenikm / gist:6124130
Created July 31, 2013 17:24
Average of weight WITH price
select id, category, price, actual_weight , round(avg(actual_weight) over(partition by category rows between 2 preceding and 2 following),2),sum(actual_weight) over(partition by category rows between 2 preceding and 2 following), status from (select id, primary_category_id_reference as category, round(price_cents/100.0, 2) as price, weight as actual_weight, status from order_items where status between 5 and 8 and created_at > '2013-04-01' order by category, price_cents desc limit 1000) a;
@jenikm
jenikm / newrelic_typhoeus_hydra.rb
Last active December 21, 2015 11:58
Provides Typhoeus::Hydra instrumentation for NewRelic. Tracks the first outgoing request that was made
#Adding external services report to track FIRST hydra request
# Adding concept to DependencyDetection to ban some dependencies that were added
#
module DependencyDetection
module_function
@banned_dependencies = []
def flag_banned_dependency(dependency)
@banned_dependencies << dependency
@jenikm
jenikm / outdated_diff_github.js
Created August 29, 2013 15:22
Opens all the outdated diffs on github
jQuery('.outdated-diff-comment-container').each(function(e){jQuery(this).addClass('open')})
@jenikm
jenikm / ssh_config
Created October 8, 2014 18:32
SSH Config
Host HEROKU.USERNAME
HostName heroku.com
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
Host home
HostName XXX.XXX.XXX.XXX
Port XXXX
LocalForward 127.0.0.1:5900 127.0.0.1:5900
@jenikm
jenikm / My vimrc
Created October 10, 2014 14:54
.vimrc
set nocompatible " be iMproved
filetype off " required!
"set rtp+=~/.vim/bundle/vundle/
"call vundle#rc()
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle