Skip to content

Instantly share code, notes, and snippets.

Alexis Metaireau almet

Block or report user

Report or block almet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View reboot.py
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()
View Makefile
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)
View gist:702281
main = problem1
problem1 = [i | i <- [1..1000], i `mod` 3 == 0 || i `mod` 5 == 0]
View gist:702623
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)
View gist:702739
fibonacci = fibo 1 1
fibo :: Int -> Int -> [Int]
fibo x y = x:(fibo x+y)
View conditions.h
// 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;
View main.js
// 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
Geolocation attempt for jetpack sdk
View geolocation.js
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 Aug 3, 2011
Or how to deploy a django application using nginx + gunicorn + supervisord
View gunicorn.conf.py
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"
View pelican-quickstart.py
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
import os, sys, argparse, string
from pelican import __version__
TEMPLATES={
'Makefile' : '''
PELICAN=$pelican
PELICANOPTS=$pelicanopts
You can’t perform that action at this time.