Skip to content

Instantly share code, notes, and snippets.

View japaz's full-sized avatar
🏠
Tired of ...

Alberto Paz japaz

🏠
Tired of ...
View GitHub Profile
@japaz
japaz / .Xdefaults
Created December 16, 2011 10:19
Solarized colors for x-term on Cygwin
!! drop in Solarized colorscheme for Xresources/Xdefaults
!!SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B RGB HSB
!!--------- ------- ---- ------- ----------- ---------- ----------- -----------
!!base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21
!!base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26
!!base01 #586e75 10/7 brgreen 240 #585858 45 -07 -07 88 110 117 194 25 46
!!base00 #657b83 11/7 bryellow 241 #626262 50 -07 -07 101 123 131 195 23 51
!!base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59
!!base1 #93a1a1 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63
@japaz
japaz / console.xml
Created December 16, 2011 10:07
Solarized colors for Console2
<!-- Solarized colors configuration for console2 -->
<!-- http://ethanschoonover.com/solarized -->
<!-- http://sourceforge.net/projects/console/ -->
<!-- Replace this colors in console.xml configuration file -->
<colors>
<color id="0" r="7" g="54" b="66"/>
<color id="1" r="38" g="139" b="210"/>
<color id="2" r="133" g="153" b="0"/>
<color id="3" r="42" g="161" b="152"/>
<color id="4" r="220" g="50" b="47"/>
@japaz
japaz / do.clj
Created December 15, 2011 22:36
7L7W Clojure - Day 1
;Implement a function called (big st n) that returns true if a string st
;is longer than n characters.
(defn big [st n] (> (count st) n))
;Write a function called (collection-type col) that returns :list, :map,
;or :vector based on the type of collection col.
(defmulti collection-type class)
(defmethod collection-type clojure.lang.IPersistentList [arg] :list)
(defmethod collection-type clojure.lang.IPersistentMap [arg] :map)
(defmethod collection-type clojure.lang.IPersistentVector [arg] :vector)
@japaz
japaz / doctor_translate.erl
Created November 25, 2011 21:50
7L7W Erlang - Day3
% Monitor the translate_service and restart it should it die.
-module(doctor_translate).
-export([loop/0]).
loop() ->
process_flag(trap_exit, true),
receive
new ->
io:format("Creating and monitoring process.~n"),
register(translator, spawn_link(fun translate_service:loop/0)),
@japaz
japaz / comprehesion.erl
Created November 23, 2011 21:39
7L7W Erlang - Day2
% Consider a shopping list that looks like [{item quantity price}, ...].
% Write a list comprehension that builds a list of items of the form
% [{item total_price}, ...], where total_price is quantity times price.
-module(comprehesion).
ShoppingList = [{apple, 4, 0.2}, {orange, 3, 1.1}, {peach, 4, 1}].
Total = [{Product, Quantity * Price} || {Product, Quantity, Price} <- ShoppingList].
@japaz
japaz / day1.erl
Created November 17, 2011 21:28
7L7W Erlang - Day 1
-module(day1).
-export([number_of_words/1]).
-export([count/1]).
-export([print_message/1]).
% Write a function that uses recursion to return the number of
% words in a string.
list_size([]) -> 0;
list_size([H|T]) -> 1+list_size(T).
@japaz
japaz / Find
Created November 3, 2011 22:23
7L7W Scala - Day 3
// For the sizer program, what would happen if you did not create a
// new actor for each link you wanted to follow?
// An actor must sent more than one message
// What would happen
// to the performance of the application?
// The performace will be worst
@japaz
japaz / Find.scala
Created October 31, 2011 23:00
7L7W Scala - Day 2
// A discussion on how to use Scala files
// http://stackoverflow.com/questions/1284423/read-entire-file-in-scala
// http://www.naildrivin5.com/blog/2010/01/26/reading-a-file-in-scala-ruby-java.html
// What makes a closure different from a code block
// http://gleichmann.wordpress.com/2010/11/15/functional-scala-closures/
// Closures have free variables, which are not bounded
@japaz
japaz / Board.scala
Created October 18, 2011 21:31
7L7W Scala - Day 1
import org.specs.runner.JUnit4
import org.specs.runner._
import org.specs._
import org.junit.runner.RunWith
import org.specs.runner.JUnitSuiteRunner
import scala.collection.mutable.HashSet
@RunWith(classOf[JUnitSuiteRunner])
class BoardSpecTest extends Specification with JUnit {
@japaz
japaz / factorial.prolog
Created October 14, 2011 22:07
7L7W Prolog - Day 2
% Some implementations of a Fibonacci series and factorials. How
% do they work?
% La sintaxis es factorial(N, F) -> Factorial de N es F (el resultado se guarda en F)
factorial(0, 1).
factorial(N, F) :- N>0, N1 is N - 1, factorial(N1, F1), F is N*F1.
%el factorial se llama recursivamente dejando el resultado en F