Skip to content

Instantly share code, notes, and snippets.

View ga2arch's full-sized avatar
🐢

Gabriele Carrettoni ga2arch

🐢
View GitHub Profile
-module(gtranslate).
-author("Gabriele <carretta63@gmail.com").
-version("0.0.1").
-define(API_URL, "http://ajax.googleapis.com/ajax/services/language/translate").
-export([translate/3, lang_pair/2, request_url/2, check_result/1]).
-import(mochijson2).
lang_pair(Lo, Ld) ->
-module(gtranslate).
-author("Gabriele <carretta63@gmail.com").
-version("0.0.1").
-define(API_URL, "http://ajax.googleapis.com/ajax/services/language/translate").
-export([translate/3, lang_pair/2, request_url/2, check_result/1]).
-import(mochijson2).
lang_pair(Lo, Ld) ->
@ga2arch
ga2arch / fm.py
Created August 24, 2011 13:46
Simple icecast radio recorder
import urllib2
save_folder = ''
stream_url = ''
def parse_metaint():
line = resp.readline()
while line:
line = resp.readline()
if 'icy-metaint' in line:
@ga2arch
ga2arch / gist:1189521
Created September 2, 2011 19:01 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job:
Favorite Python project:
Favorite Conference:
Python Experience Level:
@ga2arch
ga2arch / gist:1210059
Created September 11, 2011 20:13
Scala exp
object Apple1 extends App {
val vowels = Array('a', 'e', 'i', 'o', 'u')
println("Type a phrase")
val phrase = Console.readLine().toLowerCase
val vowel = phrase.find(vowels.contains(_)).getOrElse()
val newP = phrase.map(x => if (vowels.contains(x)) vowel else x).mkString
println(newP)
}
@ga2arch
ga2arch / gist:1253726
Created September 30, 2011 13:22 — forked from weavejester/gist:1001206
Clojure on Heroku
~/$ lein new ring-on-heroku
Created new project in: /home/jim/Development/ring-on-heroku
~/$ cd ring-on-heroku
~/ring-on-heroku$ echo 'web: lein run -m ring-on-heroku.core' > Procfile
~/ring-on-heroku$ cat > src/ring_on_heroku/core.clj
(ns ring-on-heroku.core
(:use ring.util.response
ring.adapter.jetty))
(defn app [req]
@ga2arch
ga2arch / ants.clj
Created December 18, 2011 19:10 — forked from jjcomer/ants.clj
Ant Simulation -- From Clojure Concurrency Presentation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;As shown in the presentation: http://blip.tv/clojure/clojure-concurrency-819147
@ga2arch
ga2arch / gist:1573335
Created January 7, 2012 01:07
pfetch
(ns clj-pfetch.core
(:use [clojure.java.shell :only (sh)])
(:require [clojure.xml :as xml]))
;;; Records
(defrecord Url [start href output freq args])
;;; Agents
@ga2arch
ga2arch / gist:1573338
Created January 7, 2012 01:07
pfetch
(ns clj-pfetch.core
(:use [clojure.java.shell :only (sh)]
[clojure.java.io :only (as-url input-stream)]
[clojure.string :only (blank?)])
(:require [clojure.xml :as xml]))
;;; Records
(defrecord Url [start href output freq args])
@ga2arch
ga2arch / gist:1611663
Created January 14, 2012 14:32
ex-1.11 SICP in C
#include <stdio.h>
/*
f(0) = 0
f(1) = 1
f(2) = 2
f(3) = f(2) + 2f(1) + 3f(0)
\ \ \
f(4) = f(3) + 2f(2) + 3f(1)
\ \ \