Skip to content

Instantly share code, notes, and snippets.

@db0company
db0company / gist:4103194
Created November 18, 2012 03:03
API responses
http://life.paysdu42.fr:2000/auth/login?login=toto&password=ok
{
"rspcode": 0,
"rspmsg": "SUCCESS",
"content": {
"token": "eLTmXM2sXBKgyOihQTEfXS3rVWQIFGReFZi7Ebev",
"logged": true,
"expire": "2012-11-18 05:41:13"
}
@db0company
db0company / gist:4158975
Created November 28, 2012 04:08
Error handling with Macaque (Ocsigen)
module Lwt_thread = struct
include Lwt
include Lwt_chan
end
module Lwt_PGOCaml = PGOCaml_generic.Make Lwt_thread
module Lwt_Query = Query.Make_with_Db Lwt_thread Lwt_PGOCaml
let get_db : unit -> unit Lwt_PGOCaml.t Lwt.t =
let db_handler = ref None in
fun () ->
444. Compiler Construction (3)
Prerequisites: CECS 285 and 328 all with a grade of "C" or better.
Syntax directed compiler study. Organization of a compiler and overall design: parsing, semantic analysis, optimization and code generation.
(Lecture 3 hours, laboratory 3 hours) Letter grade only (A-F).
414. Introduction to Network and System Security Issues (3)
Prerequisites: CECS 174 with a grade of "C" or better.
Controlling the risk of computer security: Security threats and vulnerabilities in the development and use of computer systems. Tools and controls that can reduce or block these threats. Topics in Network Security.
@db0company
db0company / gist:4954780
Created February 14, 2013 18:04
JQuery test with Ocsigen
(* ************************************************************************** *)
(* Project: Ocsigen Quick Howto : Javascript Inclusion *)
(* Description: Example of a page including external javascript script *)
(* Author: db0 (db0company@gmail.com, http://db0.fr/) *)
(* Latest Version is on GitHub: http://goo.gl/sfvvq *)
(* ************************************************************************** *)
open Eliom_content
open Html5.D
open Eliom_parameter
=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-03-10 06:41:43] INFO WEBrick 1.3.1
[2013-03-10 06:41:43] INFO ruby 1.9.3 (2013-02-22) [i686-linux]
[2013-03-10 06:41:43] WARN TCPServer Error: Address already in use - bind(2)
Exiting
/usr/local/lib/ruby/1.9.1/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
from /usr/local/lib/ruby/1.9.1/webrick/utils.rb:85:in `new'
POST /auth/session HTTP/1.1
Host: paysdu42.fr:3000
Connection: keep-alive
HTTP/1.1 411 Length Required
Content-Type: text/html; charset=ISO-8859-1
Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
Date: Sun, 10 Mar 2013 06:28:43 GMT
Content-Length: 305
Connection: close
db0@Ohana:/tmp$ nc paysdu42.fr 3000
POST /articles HTTP/1.1
Host: paysdu42.fr:3000
title=test&category=pedago
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=ISO-8859-1
Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
Date: Sun, 10 Mar 2013 06:38:26 GMT
Content-Length: 316
MultiJson::LoadError in ArticlesController#create
399: unexpected token at '{"title"=>"test", "user_id"=>"1", "publication_date(1i)"=>"2013", "publication_date(2i)"=>"3", "publication_date(3i)"=>"10", "publication_date(4i)"=>"06", "publication_date(5i)"=>"34", "thumbnail"=>"0", "nb_comments"=>"0", "content"=>"test", "category"=>"0", "status"=>"1", "score_id"=>"2", "event_id"=>"0"}]'
Rails.root: /home/sv/ws
Application Trace | Framework Trace | Full Trace
app/controllers/articles_controller.rb:47:in `create'
Request
Parameters:
db0@Ohana:~$ mplayer Downloads/01.opus
MPlayer svn r34540 (Ubuntu), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing Downloads/01.opus.
libavformat version 53.21.1 (external)
Mismatching header version 53.19.0
libavformat file format detected.
db0@gangbang:~/dev/eip/API$ npm install
npm http GET https://registry.npmjs.org/mongoose/3.5.6
npm http 304 https://registry.npmjs.org/mongoose/3.5.6
npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: mongoose@3.5.6
npm ERR! Required: {"node":">=0.6.19"}
npm ERR! Actual: {"npm":"1.1.4","node":"0.6.12"}
npm ERR!
npm ERR! System Linux 3.2.0-30-generic