Skip to content

Instantly share code, notes, and snippets.

View toff63's full-sized avatar

Christophe Marchal toff63

View GitHub Profile
#!/bin/bash
#echo "received $1 $2" >> /home/toff/bin/skype-log.txt
if [[ "$2" == *french* ]]; then notify-send "$1" "$2" -i skype; fi
if [[ "$2" == *christophe* ]]; then notify-send "$1" "$2" -i skype; fi
if [[ "$2" == *frances* ]]; then notify-send "$1" "$2" -i skype; fi
if [[ "$2" == *Pessoal* ]]; then notify-send "$1" "$2" -i skype; fi
if [[ "$2" == *pessoal* ]]; then notify-send "$1" "$2" -i skype; fi
(use '[datomic.api :only [q db] :as d])
(use 'clojure.pprint)
;; store database uri
(def uri "datomic:mem://seattle")
;; create database
(d/create-database uri)
;; connect to database
;; find all community names and urls -- implicit join
(pprint (seq (q '[:find ?n ?u
:where
[?c :community/name ?n]
[?c :community/url ?u]]
(db conn))))
;; return
;; (["Chinatown/International District" "http://www.cidbia.org/"]
;; ["All About Belltown" "http://www.belltown.org/"]
;; ["Friends of Discovery Park" "http://www.friendsdiscoverypark.org/"])
(use '[datomic.api :only [q db] :as d])
(use 'clojure.pprint)
;; store database uri
(def uri "datomic:mem://db-as-a-value")
;; create database
(d/create-database uri)
;; connect to database
-module(event_handler_template).
-behaviour(gen_event).
%% API
-export([start_link/0, add_handler/2]).
%% gen_event callbacks
-export([init/1, handle_event/2, handle_call/2, handle_info/2,
terminate/2, code_change/3]).
@toff63
toff63 / erlang_code_upgrade.html
Created August 11, 2012 14:31
Erlang code upgrade at runtime
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Erlang code upgrade otp</title>
<style type="text/css" media="screen">
.command{color: green;}
.response{color: blue;}
</style>

Segregation And Peer Effects

We tend to live with people like us VS We tend to change to looks like people we live with === Sorting vs Peer Effects

  • Schelling tipic model: segregation model
  • Granovetter model
  • Standing ovation model: peer effect
  • Identification problem: is it sort effect or peer effect
Observing the tutorial http://twitter.github.com/scala_school/basics.html
I understand that the difference between partial and curry is that curry is by design:
in scala and clojure you can use partial to get a new funcion:
def add(x:Int, y:Int):Int = x + y
val add2 = add(2,_:Int)
(partial add 2)
Blog post here http://www.grobmeier.de/the-10-rules-of-a-zen-programmer-03022012.html
1. Focus: kill interruptions and focus on what you are doing and don't let anything interrup you.
2. Keep your mind clean: do it before starting a task so your mind let you focus on your task
3. Beginners mind: act as a beginner so you discover more, let people talk and learn from them. It helps accepting critics.
4. No ego. You are good at coding and then? what about others activities? It doesn't make you special. Programmers with ego don't learn
5. There is no career goal. Don't wait to be happy. Be happy everyday, do not wait to reach a goal to be happy. NEVER stay at a company which does take away the happiness in your live.
6. Shut up! if you have nothing to talk, just listen ;)
7. Mindfullness. Care. Awareness You live alone and you’ll die alone. World goes on, even without you. Stop crying. Do thing with all care you can. Everything, even boring things. Do everything the best you can, even things you dislike to do.
Intuitive, safe way to handle concurrency tasks with groovy
High level abstraction to write concurrent code in groovy: map/reduce, fork/join, asynchronous closures, actors, agent, dataflow concurrency and other concepts.
You can use Gpars from java, but the price is the verbosity
3 concepts:
* Code level helper: Parallel collections, asynchronous processing, fork/join (divide/conquer)
* Architectural concepts: actors, communicating sequential processes, dataflow concurrency.