Skip to content

Instantly share code, notes, and snippets.

function loadScript(url, callback) {
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = url;
var done = false;
script.onload = script.onreadystatechange = function() {
if( !done && ( !this.readyState || this.readyState == "loaded" || this.readyState == "complete") ) {
done = true;
callback();
// Handle memory leak in IE
# yeah there might be an even easier way but this was put together really quick and all
require 'rubygems'
require 'nokogiri'
require 'open-uri'
shiturl = "http://www.cloneshit.hu/category/podcast/page/"
gotit = []
[1, 2, 3, 4, 5].each do |page|
page = Nokogiri(open("#{shiturl}#{page}"))
(page/'div[@class="postcontent"]'/:a).each do |item|
#!/usr/bin/env ruby
# encoding: UTF-8
require 'rubygems'
require 'hpricot'
require 'open-uri'
doc = Hpricot(open('http://www.versradio.hu/?module=search&mode=hangzo'))
doc.search('div.listitem').each do |item|
system("curl -o '#{item.search('span.author').html} - #{item.search('span.title').html}.mp3' http://www.versradio.hu/data/audio/#{item.search('span.fileid').html}.mp3")
end
server {
server_name blog.ktamas.com;
root /var/www/blog.ktamas.com;
include /etc/nginx/fastcgi_php;
location / {
gzip on;
gzip_http_version 1.0;
gzip_vary on;
gzip_comp_level 3;
gzip_proxied any;
// Authors:
// KTamas <gmail@ktamas.com>
register({
name: "iwiw",
url: "http://iwiw.hu/",
domains: ["iwiw.hu", "wiw.hu"],
sessionCookieNames: ["ajaxable", "__utmz", "JSESSIONID", "autoLoginNew","forgetEmail", "email", "httpslogin", "__utma", "__utmc", "__utmb", "lastHit", "_goa3", "_goa3TC", "_goa3TS", "DA", "DRPDI"],
identifyUser: function() {
var resp = this.httpGet("http://iwiw.hu/pages/main/index.jsp");
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
mkdir ~/src
cd ~/src
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
<html>
<head>
<script type="text/javascript">
var close_and_redirect = function() {
if (opener && !opener.closed) {
opener.location.href = "http://localhost:9610/done";
}
window.close();
}
</script>
@KTamas
KTamas / wo2008bot.rb
Created June 9, 2011 10:01
wo2008 irc bot
require 'rexml/document'
require 'time'
class WO2008Plugin < Plugin
WO_TAPI_PREFIX = "http://wormolympics.com/api/tournaments/"
def help(plugin, topic="")
"Worm Olympics 2008 Tourney Schedule InfoBot.\nTriggers: !!wo today, !!wo tomorrow, !!wo next, !!wo date, where date is YYYY-MM-DD i.e. !!wo 2008-08-31"
end
irc = require 'irc'
navi = new irc.Client 'hub.irc.hu', 'Navi', debug:true, channels: ['#nonesuch']
Array::random = ->
@[Math.floor Math.random()*@length]
navi.hey = navi.addListener
navi.addListener 'message', (from, to, message) ->
navi.on 'weather', (from, to, message) ->
query =
host: "koponyeg.hu"
port: 80
path: 'idojaras_rss.php?regios=1'
http.get query, (res) ->
body = ""
res.on 'data', (chunk) -> body += chunk
res.on 'end', ->