Skip to content

Instantly share code, notes, and snippets.

@2xyo
2xyo / mkappenginevenv.sh
Created May 7, 2012 15:38 — forked from rob-b/mkappenginevenv.sh
Setup virtual env for appengine
#!/bin/bash
#
# Build a virtual environment suitable for running appengine.
# This uses virtualenvwrapper to make the virtual environment
# and modifies the postactivate/postdeactivate scripts to make
# the appengine code happy.
#
# Usage:
# $ curl -s https://raw.github.com/gist/2628491 | bash
#
@2xyo
2xyo / Python_Rest_API
Created May 24, 2012 06:32
Simple REST API in Python
#!/usr/bin/python
import json
import bottle
from bottle import static_file, route, run, request, abort, response
import simplejson
import pymongo
from pymongo import Connection
import datetime
@2xyo
2xyo / gist:2779912
Created May 24, 2012 06:56
Sencha Rest Proxy
Ext.require(['Ext.data.*', 'Ext.grid.*']);
Ext.define('Equipement', {
extend: 'Ext.data.Model',
fields: [{
name: '_id',
type: 'int',
useNull: true
}, 'name', 'plateforme']
});
@2xyo
2xyo / bandwidth.sh
Created May 31, 2012 14:57
Realtime Bandwidth monitor
#!/bin/bash
clear
declare -i rxnow txnow txlast rxlast
while true
do
chain=`ifconfig $1|grep bytes`
rxnow=`echo $chain | cut -d ":" -f2 | cut -d " " -f1`
txnow=`echo $chain | cut -d ":" -f3 | cut -d " " -f1`
@2xyo
2xyo / gif.py
Created August 1, 2012 13:12
Small script to send gif by mail...
#!/usr/bin/env python
import imaplib
from pprint import pprint
from email.parser import HeaderParser
from django.core.mail import EmailMultiAlternatives
from email.mime.message import MIMEMessage
from django.conf import settings
import os,random,sys
from email import Charset
from email.mime.image import MIMEImage
@2xyo
2xyo / getsatisfaction.txt
Created August 27, 2012 14:06
Template Foursquare
http://getsatisfaction.com/foursquare/topics/europe_main_thread_for_merges_edits
1) Edit and Merge
Venue Name:
Address:
Cross Street:
City:
State/Country:
Postal Code:
Lat/Long:
@2xyo
2xyo / netifaces.c
Created October 1, 2012 08:26
Netifaces python3
#include <Python.h>
#ifndef WIN32
# include <sys/types.h>
# include <sys/socket.h>
# include <net/if.h>
# include <netdb.h>
# if HAVE_SOCKET_IOCTLS
@2xyo
2xyo / dl.py
Created October 3, 2012 21:38
DL gifs from senorgif..
# imageDownloader.py
# Finds and downloads all images from any given URL recursively.
# FB - 201009094
import urllib2
from os.path import basename
import urlparse
from BeautifulSoup import BeautifulSoup # for HTML parsing
global page
page = 1
print page
@2xyo
2xyo / Activity diagram
Created October 21, 2012 17:22
Apport crashDB implementation for github
title Github implementation of crash database interface
alt Github credential is not present
Client->Client: Prompt username
alt is X session:
Client->Github:Open browser to ask autorisation
@2xyo
2xyo / POST request
Last active December 15, 2015 22:19
Bitcasa command-line interface with Casper.js
POST /uploader/download-to-bitcasa HTTP/1.1
Host: portal.bitcasa.com
Connection: keep-alive
Content-Length: 124
Accept: */*
Origin: chrome-extension://jbebdjcjllheeclffnofhgcimmlkkbon
User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.22 (KHTML, like Gecko) Ubuntu Chromium/25.0.1364.160 Chrome/25.0.1364.160 Safari/537.22
X_REQUESTED_WITH: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
DNT: 1