Skip to content

Instantly share code, notes, and snippets.

View jerem's full-sized avatar

Jérémy Bethmont jerem

View GitHub Profile
letters = ['A', 'B', 'C']
nb_letters = len(letters)
total = 100
step = total / nb_letters
index = 0
results = []
for i in range(1, total + 1):
if index == nb_letters:
index -= 1
# -*- coding: utf-8 -*-
import os
import re
import datetime
from ftplib import FTP
from BeautifulSoup import BeautifulSoup
_multilines_re = re.compile(r'<([a-z0-9\-]+)\s+(.*?)\s+</\1>', re.S | re.M)
_singleline_re = re.compile(r'<(product|version)>\s+(.+)$', re.M)
#!/usr/bin/env python
import sys
import os
if __name__ == '__main__':
module = __import__(sys.argv[1])
path = module.__file__.replace('.pyc', '.py')
if os.path.basename(path) == '__init__.py':
path = os.path.dirname(path)
print 'Opening "%s"' % path
@jerem
jerem / test.js
Created January 10, 2012 14:09
Mongoose toJSON
var mongoose = require('mongoose')
, Schema = mongoose.Schema
mongoose.connect('localhost', 'testing_tojsonWithVirtuals');
var PersonSchema = new Schema({
name : String
, age : Number
});
@jerem
jerem / bug.js
Created March 2, 2012 17:56
Mongoose array bug
var mongoose = require('mongoose');
var TestSchema = new mongoose.Schema({
a : Array,
s : String,
n : Number
});
var Test = mongoose.model('Test', TestSchema);
mongoose.connection.once('open', function() {
@jerem
jerem / s3delete.py
Last active October 9, 2015 10:28
A python/gevent script to quickly delete a very large Amazon S3 bucket.
#!/usr/bin/env python
import gevent.monkey
gevent.monkey.patch_all()
import sys
import optparse
import gevent
from boto.s3.connection import S3Connection
@jerem
jerem / dbproxy.py
Created January 8, 2013 15:29
This is a sample code that shows how to use an HTTP proxy with dropbox sdk for Python.
# Include the Dropbox SDK libraries
import httplib
from dropbox import client, rest, session
# Proxy settings
HTTP_PROXY_HOST = '127.0.0.1'
HTTP_PROXY_PORT = 8888
# Get your app key and secret from the Dropbox developer website
APP_KEY = 'XXXXX'
@jerem
jerem / gist:6256670
Created August 17, 2013 12:24
Clean all the log on a system.
sudo find /var/log -type f -exec sh -c 'echo -n "" > "{}"' \;
@jerem
jerem / gist:6332286
Created August 25, 2013 06:08
MK802 III bootlog
DDR Version 1.00 20120529
In
DDR3
freq
300MHz
config state
pctl
phy
mem
#!/system/bin/sh
chown system.wifi /data/misc/wifi/wpa_supplicant.conf