Skip to content

Instantly share code, notes, and snippets.

View sxua's full-sized avatar
🇺🇦

Oleksandr Skrypnyk sxua

🇺🇦
View GitHub Profile
@sxua
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
else
return false
end
end
function serve_gzip(cached_page)
@sxua
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("http://vkontakte.ru/wall-#{gid}")
agent = Mechanize.new
@sxua
sxua / brew_uninstall.sh
Created November 20, 2011 00:05
Remove Homebrew's "has multiple installed versions"
#!/bin/bash
ruby -I/usr/local/Library/Homebrew -rglobal -rkeg -e 'k = Keg.new("/usr/local/Cellar/#{pkg}/#{version}"); puts k.unlink; k.uninstall'
@sxua
sxua / killapache.rb
Created November 30, 2011 23:43
Just a try to rewrite killapache.pl
#!/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 http://www.example.com/images/photo.jpg 50\n"
end
@sxua
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
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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.0</real>
<key>Green Component</key>
<real>0.0</real>
@sxua
sxua / skype.sh
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
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 = '********@gmail.com'
PASSWORD = '********'
Forever.run do
before :all do
@sxua
sxua / tricks.sh
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
sxua / alert.js
Created August 10, 2012 21:05
just a few words
[][(![]+[])[!+[]+!![]+!![]]+({}+[])[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][({}+[])[!+[]+!![]+!![]+!![]+!![]]+({}+[])[+!![]]+([][+[]]+[])[+!![]]+(![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+[]]+({}+[])[!+[]+!![]+!![]+!![]+!![]]+(!![]+[])[+[]]+({}+[])[+!![]]+(!![]+[])[+!![]]]((+{}+[])[+!![]]+(![]+[])[!+[]+!![]]+([][+[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]+[][(![]+[])[!+[]+!![]+!![]]+({}+[])[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][({}+[])[!+[]+!![]+!![]+!![]+!![]]+({}+[])[+!![]]+([][+[]]+[])[+!![]]+(![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+[]]+({}+[])[!+[]+!![]+!![]+!![]+!![]]+(!![]+[])[+[]]+({}+[])[+!![]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+([][+[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+([][+[]]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+!![]]+({}+[])[!+[]+!![]+!![]+!![]+!![]+!![]+!![]]+([][+[]]+[])[+[]]+([][+[]]+[])[+!![]]+([][+[]]+[])[!+[]+!![]+!![]]+(![]+[])[!+[]+!![]+!![]]+({}+[])[!+[]+!![]+!![]+!![]+!![]]+(+{}+[])[+!![]]+([]+[][(![]+[])[!+[]+