Skip to content

Instantly share code, notes, and snippets.

View sxua's full-sized avatar

Oleksandr Skrypnyk sxua

View GitHub Profile
sxua / rewrite.lua
Created October 2, 2011 23:19
Lighttpd rewrite conditions written in Lua for WP Super Cache
function serve_html(cached_page)
if (lighty.stat(cached_page)) then
lighty.env["physical.path"] = cached_page
return true
return false
function serve_gzip(cached_page)
sxua / get.rb
Created October 8, 2011 16:54
Fetch posts from VK wall (./get.rb remixsid_cookie_value, group_id)
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
require 'fastercsv'
require 'progressbar'
cookie, gid = ARGV
url = URI.parse("{gid}")
agent =
sxua /
Created November 20, 2011 00:05
Remove Homebrew's "has multiple installed versions"
ruby -I/usr/local/Library/Homebrew -rglobal -rkeg -e 'k ="/usr/local/Cellar/#{pkg}/#{version}"); puts k.unlink; k.uninstall'
sxua / killapache.rb
Created November 30, 2011 23:43
Just a try to rewrite
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'forkmanager'
def usage
puts "Apache Remote Denial of Service (memory exhaustion)\nusage: ruby killapache.rb <url> [numforks]\nexample: ruby killapache.rb 50\n"
sxua / eval_method.rb
Created December 6, 2011 14:00
eval of method
eval([('d'..'f'), [['my', 'method'].join('_')], ["\n"]].map(&:to_a).map(&:join).join(' ') + ['puts "That\'s my method!"','end','my_method'].join("\n"))
sxua / my.itermcolors.xml
Created December 10, 2011 02:24
My iTerm2 colors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<key>Ansi 0 Color</key>
<key>Blue Component</key>
<key>Green Component</key>
sxua /
Created December 12, 2011 15:01
Skype notifications in Ubuntu
notify-send -i skype "%sname" "телефонує вам"
notify-send -i skype "%sname" "з'явився в мережі"
notify-send -i skype "%sname" "вийшов з мережі"
notify-send -i skype "%sname" "запит контакту"
notify-send -i emblem-people "%sname" "доданий у ваш список"
notify-send -i emblem-people "%sname" "видалений з вашого списку контактів"
skypenotify "%sname" "%smessage"
skypenotify "%sname" "%smessage"
notify-send -i emblem-people "%sname" "приєднався до чату"
notify-send -i emblem-people "%sname" "вийшов з чату"
sxua / fetcher.rb
Created December 12, 2011 23:14
Doesn't work after few (4-5) loops
#!/usr/bin/env ruby
require 'rubygems' unless defined?(Gem)
require 'forever'
require 'gmail'
USER_NAME = '********'
PASSWORD = '********' do
before :all do
sxua /
Created March 27, 2012 13:20
Useful tricks
echo "TextMate 2 File browser on the right side"
defaults write com.macromates.TextMate.preview fileBrowserPlacement right
sxua / alert.js
Created August 10, 2012 21:05
just a few words