Skip to content

Instantly share code, notes, and snippets.

@uri
uri / bitbucket-import.rb
Created June 25, 2012 23:02
Import public repos from Bitbucket to Github
require 'httparty'
class Github
include HTTParty
base_uri "https://api.github.com"
BaseDirectory = "/Users/ugorelik/programming/repos"
def initialize(u, p)
@auth = { username: u, password: p}
load_bitbucket_repos
a
about
above
across
act
active
activity
add
afraid
after
str=gets
unless str.nil? && str != ""
puts str
else
puts "gets produced nil or didn't ask for input."
end
@uri
uri / enable_LTE_n4.sh
Last active December 18, 2015 13:59
Android LTE feather script
#!/system/bin/sh
iptables -A bw_FORWARD -i !lo+
iptables -A natctrl_FORWARD -j RETURN -i rmnet+ -o wlan0 -m state --state RELATED,ESTABLISHED
iptables -A natctrl_FORWARD -j DROP -i wlan0 -o rmnet+ -m state --state INVALID
iptables -A natctrl_FORWARD -j RETURN -i wlan0 -o rmnet+
iptables -A natctrl_FORWARD -j DROP
iptables -A natctrl_nat_POSTROUTING -t nat -o rmnet+ -j MASQUERADE
@uri
uri / rben cron
Created June 26, 2013 15:56
Run a crontab with rbenv
*/1 * * * * PATH=$PATH:/usr/local/bin && bash -lc "ruby ~/bin/gitapi"
*/1 * * * * PATH=$PATH:/usr/local/bin && bash -lc "ruby /Users/ugorelik/bin/test"
@uri
uri / uri-hack-1.rb
Created June 11, 2014 17:27
Uri's Mini hack challenge: 1
# Take an array [221,222,223,224] and turn it into {221 => 1, 222 => 1, 223 => 1, 224 => 1}
start = [221,222,223,224]
# My almost illegible implementation
result = Hash[*start.map(&:id).zip([1] * start.count)]
# from http://fredkschott.com/post/2014/02/git-log-is-so-2005/
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"
@uri
uri / _readme.md
Last active August 29, 2015 14:17 — forked from mislav/_readme.md

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@uri
uri / vim-ruby-syntime.txt
Created June 18, 2015 17:59
syntime for ruby syntax
TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN
4.678966 1003 0 0.006825 0.004665 rubySymbol []})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@=
4.085646 584726 0 0.000114 0.000007 rubyString \\\\\|\\\"
2.570973 1003 0 0.004286 0.002563 rubySymbol \%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!
2.078462 294332 294332 0.000106 0.000007 rubyArrayLiteral ]
@uri
uri / post-commit
Last active December 14, 2015 19:29
A post-commit hook that will check for changed assets and ask if they should be compiled.
#!/bin/bash
ASSET_FILES="$(git diff-index --name-only HEAD~ | egrep '.+\.(?:js|css|jpg|jpeg|png|gif)' | grep -v 'public/')"
if [[ ! -z $ASSET_FILES ]] ; then
echo 'You have changed the following assets that need to be compiled:'
echo $ASSET_FILES
# Allows us to read user input below, assigns stdin to keyboard
exec < /dev/tty