Skip to content

Instantly share code, notes, and snippets.

View almet's full-sized avatar
🗺️

Alexis Métaireau almet

🗺️
View GitHub Profile
import urllib2
import urlparse
import re
import argparse
REBOOT_URL = '/b/info/restart/?be=0&l0=1&l1=0&tid=RESTART'
BOX_URL = 'http://bebox.config/cgi'
def open_url(url, username, password):
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
PROJECT = pigeonhol
LIB = lib/
SRC = src/
BUILD = build/
OBJ = main.o observer.o
LIBS = inotify-cxx
CPP = g++
CXXFLAGS = -Wall -ansi -pedantic-errors
all: $(OBJ)
main = problem1
problem1 = [i | i <- [1..1000], i `mod` 3 == 0 || i `mod` 5 == 0]
main = do print(sumlist problem1)
problem1 = [i | i <- [1..1000], i `mod` 3 == 0 || i `mod` 5 == 0]
sumlist [] = 0
sumlist (head:tail) = head + sumlist(tail)
fibonacci = fibo 1 1
fibo :: Int -> Int -> [Int]
fibo x y = x:(fibo x+y)
// that's the condition interface; A condtion have just to be met
class Condition {
public:
virtual bool isMet(File&) const = 0;
};
class FilenameEquals : public Condition
{
FilenameEquals(string);
bool isMet(File&) const;
// default ports
const data = require("self").data;
const panels = require("panel");
const widgets = require("widget");
exports.main = function(options, callbacks){
// manage widget
var widget = widgets.Widget({
id: "main",
label: 'Suggest!',
@almet
almet / geolocation.js
Created May 18, 2011 17:19
Geolocation attempt for jetpack sdk
const {Cc, Ci} = require("chrome");
const self = require("self");
exports.getPosition = getPosition;
/**
* Return the geolocation object
**/
function getGeolocation(){
return Cc["@mozilla.org/geolocation;1"]
@almet
almet / gunicorn.conf.py
Created August 3, 2011 15:04
Or how to deploy a django application using nginx + gunicorn + supervisord
backlog = 2048
daemon = False
debug = True
workers = 3
logfile = "/usr/local/www/lolnet.org/reader/reader.gunicorn.log"
loglevel = "info"
bind = "unix:/usr/local/www/lolnet.org/reader/reader.gunicorn.sock"
@almet
almet / pelican-quickstart.py
Created August 11, 2011 21:39
Pelican-quickstart
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
import os, sys, argparse, string
from pelican import __version__
TEMPLATES={
'Makefile' : '''
PELICAN=$pelican
PELICANOPTS=$pelicanopts