This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% depends: https://github.com/talentdeficit/jsx | |
-module(youtube). | |
-export([ircmain/1, ircproc/1, reload/2]). | |
-define(API_KEY, "GetYourOwnApiKeyFromGoogle"). | |
query_gdata_feed(VID) -> | |
URL = "https://www.googleapis.com/youtube/v3/videos?part=snippet&" | |
"fields=items/snippet(channelTitle,title)&key=" ?API_KEY "&id=" ++ VID, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
pinMode(3, OUTPUT); | |
} | |
void loop() { | |
http://hsbp.org | |
PIND |= 8; | |
goto http; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://hsbp.org/arduino | |
#include <Stepper.h> | |
Stepper myStepper(100, 8, 10, 9, 11); | |
// The setup() method runs once, when the sketch starts | |
void setup() { | |
// initialize the digital pin as an output: | |
Serial.begin(9600); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(leet). | |
-export([ircmain/1, ircproc/1, reload/2]). | |
ircmain(Contact) -> | |
spawn(?MODULE, ircproc, [Contact]). | |
reload(Contact, Pid) -> | |
Pid ! reloaded, | |
ircproc(Contact). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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. |