Skip to content

Instantly share code, notes, and snippets.

@dnet
dnet / gist:335901
Created March 18, 2010 00:15
Java policy file for JDBC lab
grant codeBase "http://rapid.eik.bme.hu/-" {
permission java.net.SocketPermission "rapid.eik.bme.hu:1521", "connect";
permission java.util.PropertyPermission "oracle.jdbc.*", "read";
permission java.util.PropertyPermission "user.name", "read";
};
@dnet
dnet / gist:468518
Created July 8, 2010 20:01
#hspbp Topic Generator ötletforrás
# hspbp-topicgen ötletforrás
# http://github.com/dnet/hspbp-topicgen
#
# minden ötlet kerüljön külön sorba, a #-el kezdődő ill. üres sorok megjegyzések
# az ötletekben két ~s lehet, első a feladóra, második a tárgyra helyettesítődik be
# minta: [levlista] Felado: ~s || Targy: ~s
# az első IRC-s ötlet, később törölhető nyugodtan, csak ne legyen üres a fájl
kepzeljetek, ~s irt a levlistara ~s targgyal
@dnet
dnet / ivd.erl
Created June 12, 2011 08:53
Indavideó downloader
% Downloader for http://indavideo.hu/
% Author: András Veres-Szentkirályi <[email protected]>
% License: MIT
-module(ivd).
-export([getvideos/1]).
getvideos(URL) ->
VID = url2vid(URL),
AmfReq = <<"\0\x03\0\0\0\x01\0!player.playerHandler.getVideoData\0\x02"
@dnet
dnet / gist:1021840
Created June 12, 2011 18:20
SUDS: PasswordText without nonce and created
POST /?wsdl HTTP/1.1
Accept-Encoding: identity
Content-Length: 757
Soapaction: "say_hello"
Host: 127.0.0.1:15100
User-Agent: Python-urllib/2.7
Connection: close
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="tns" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><wsse:Security mustUnderstand="true"><wsse:UsernameToken><wsse:Username>foo</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">bar</wsse:Password></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><ns0:Body><ns1:say_hello><ns1:name>world</ns1:name><ns1:times>3</ns1:times></ns1:say_hello></ns0:Body></SOAP-ENV:Envelope>
@dnet
dnet / github.erl
Last active September 26, 2015 03:38
GitHub module for IRCnet #hspbp channel
% depends: https://github.com/talentdeficit/jsx
-module(github).
-export([ircmain/1, ircproc/1, reload/2]).
query_repo_json(User, Repo) ->
URL = "https://api.github.com/repos/" ++ User ++ "/" ++ Repo,
{ok, {_, _, JSON}} = httpc:request(get,
{URL, [{"User-Agent", "dehat-github"}]}, [], [{body_format, binary}]),
JSON.
@dnet
dnet / leet.erl
Created June 23, 2011 18:41
1337 module for IRCnet #hspbp channel
-module(leet).
-export([ircmain/1, ircproc/1, reload/2]).
ircmain(Contact) ->
spawn(?MODULE, ircproc, [Contact]).
reload(Contact, Pid) ->
Pid ! reloaded,
ircproc(Contact).
@dnet
dnet / videotar.sh
Created October 14, 2011 20:49
MTV videotár player
#!/bin/sh
# MTV videotar player
if [ $# -lt 1 ]; then
echo "Usage: $0 <videotar URL> [additional parameters to player]" >&2
exit 1
fi
CURL="curl -silent"
URL=$($CURL "$1" | sed -n 's/^.*\(http.*wmv\).*$/\1/p')
@dnet
dnet / unshort.erl
Created February 9, 2012 12:28
Simple Erlang URL unshortener
-module(unshort).
-export([unshort/1]).
unshort(URL) -> unshort(URL, 32).
unshort(URL, TTL) when TTL > 0 ->
{ok, {_, Headers, _}} = httpc:request(head, {URL, []}, [{autoredirect, false}], []),
case proplists:get_value("location", Headers) of
undefined -> URL;
Location -> unshort(Location, TTL - 1)
end.
@dnet
dnet / unshortener.erl
Created February 9, 2012 12:30
Erlang IRC bot unshortener module
% depends: https://gist.github.com/1779650
-module(unshortener).
-export([ircmain/1, ircproc/1, reload/2]).
recognize_url(Input) ->
{match, URLs} = re:run(Input,
"https?://(t.co|tinyurl.com|bit.ly)/[a-zA-Z0-9\-_]+",
[{capture, first, list}, global]),
"[unshortened] " ++ string:join(lists:map(fun unshort:unshort/1,
@dnet
dnet / eeprom_repl.ino
Created December 5, 2012 21:18
Arduino workshop: adattárolás (2012. november 29.)
#include <EEPROM.h>
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {