Skip to content

Instantly share code, notes, and snippets.

...
let data = String(count: 100*1024*1024, repeatedValue: Character("A")).dataUsingEncoding(NSUTF8StringEncoding)!
let chunkSize = 5 * 1024 * 1024 // 5MB
var offset = 0
var sessionId = ""
func uploadFirstChunk() {
let size = min(chunkSize, data.length)
self.client.files.uploadSessionStart(body:
@smarx
smarx / app.py
Last active December 31, 2015 16:39
from flask import Flask, redirect, url_for, session, request, render_template
from dropbox.client import DropboxClient, DropboxOAuth2Flow
import dropbox
import redis
from datetime import datetime, timedelta
import os
# Token for the account holding the images
my_token = os.environ['TOKEN']
@smarx
smarx / smapi.coffee
Created June 10, 2011 02:14
Node.js, CoffeeScript, and the Windows Azure Service Management API
###
certificate generated via:
openssl req -x509 -nodes -days 365 -subj "/CN=test" -newkey rsa:1024 -keyout priv.pem -out pub.pem
openssl x509 -outform der -in pub.pem -out pub.cer
(pub.cer is what's uploaded to Windows Azure via the portal)
###
crypto = require 'crypto'
https = require 'https'
fs = require 'fs'
@smarx
smarx / wasmapi.js
Created June 9, 2011 02:30
Making my first call to the Windows Azure Service Management API from Node.js
/* certificate generated via:
openssl req -x509 -nodes -days 365 -subj '/CN=test' -newkey rsa:1024 -keyout priv.pem -out pub.pem
openssl x509 -outform der -in pub.pem -out pub.cer
(pub.cer is what's uploaded to Windows Azure via the portal)
*/
var crypto = require('crypto'),
https = require('https'),
fs = require('fs');