Skip to content

Instantly share code, notes, and snippets.

function buildmessage(params){
var boundary = 'sAxIqse3tPlHqUIUI9ofVlHvtdt3tpaG'
//
// var body = [
// "Content-Type: multipart/form-data;boundary="+boundary ,
// "Content-Length:" +params.content.length,
// "--"+boundary,
// "Content-Disposition: form-data, file=" + params.file,
@dusual
dusual / __init__.py
Created September 20, 2011 14:07
The main file of my new Siesta fork that uses httplib2 and handles different auth methods
# Python Siesta
#
# Copyright (c) 2008 Rafael Xavier de Souza
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
function escapePath(p) {
return encodeURIComponent(p)
.replace(/%2F/g, '/')
.replace(/\)/g, '%29')
.replace(/\(/g, '%28');
}
// test for jsonp callback functionality
function escapePath(p) {
return encodeURIComponent(p)
.replace(/%2F/g, '/')
.replace(/\)/g, '%29')
.replace(/\(/g, '%28');
}
// test for jsonp callback functionality
@dusual
dusual / rsvp.py
Last active December 15, 2015 19:09
#Email Decode imports
from email import Encoders
import random
import imaplib,rfc822, re, StringIO, time, os, sys
from time import strftime
from datetime import datetime, timedelta
import email, email.Errors, email.Header, email.Message, email.Utils
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
@dusual
dusual / schema.py
Created September 18, 2013 11:56
A basic pony test
from datetime import datetime
from datetime import timedelta
from pony.orm import *
db = Database("sqlite", "data.sqlite", create_db=True)
class User(db.Entity):
#Answer 3 : Correcting User db
domain = Optional('Domain')
@dusual
dusual / gist:6608184
Created September 18, 2013 12:01
flask test
from flask import Flask, request, render_template,session
import plivohelper
import os
from simplekv.memory import DictStore
from flaskext.kvsession import KVSessionExtension
from datetime import datetime
import flask
import pickle
import urllib
@dusual
dusual / gist:9838932
Last active December 1, 2021 19:08 — forked from defnull/gist:1224387
mkdir heroku
cd heroku/
virtualenv --no-site-packages env
source env/bin/activate
pip install bottle gevent
pip freeze > requirements.txt
cat >app.py <<EOF
try:
import gevent.monkey
@dusual
dusual / future
Last active August 29, 2015 14:07 — forked from meson10/future
function abc() {
var deferred = $.Deferred();
(function() {
var a = 1;
deferred.resolve(a);
})();
return deferred.promise();
}
United States
Albania
American Samoa
Armenia
Australia
Austria
Azerbaijan
Belarus
Belgium
Bosnia and Herzegovina