Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import sys
import datetime
import time
from datetime import timedelta
sys.path.append('/home/reb/local/azure-sdk-for-python/')
from azure.storage import *
@websider
websider / gearman-client-batch-example.php
Last active August 29, 2015 14:27 — forked from hjr3/gearman-client-batch-example.php
Gearman client batch job example
<?php
$complete = 0;
$fail = 0;
$gmc = new GearmanClient;
$gmc->addServer();
$gmc->setCompleteCallback(function() use (&$complete) {
$complete++;
@websider
websider / gearman-client-exception-callback.php
Last active August 29, 2015 14:27 — forked from hjr3/gearman-client-exception-callback.php
pecl/gearman client exception callback example
<?php
$gmc= new GearmanClient();
$gmc->addServer();
$gmc->setExceptionCallback(function(GearmanTask $task) {
$m = $task->data();
echo "Exception: {$m}\n";
@websider
websider / gearman-worker-exception.php
Last active August 29, 2015 14:27 — forked from hjr3/gearman-worker-exception.php
pecl/gearman worker exception
<?php
$gmw = new GearmanWorker();
$gmw->addServer();
$gmw->addFunction('test', function(GearmanJob $job) {
throw new Exception('Boom');
});
while(1) $gmw->work();
@websider
websider / building-static-nginx.txt
Created January 4, 2016 05:35 — forked from rjeczalik/building-static-nginx.txt
Notes on building nginx as a static binary.
# Building static nginx for teh lulz
#
# basic dependencies
sudo apt-get install libxslt1-dev libxml2-dev zlib1g-dev libpcre3-dev libbz2-dev libssl-dev
# download nginx and openssl
wget http://nginx.org/download/nginx-1.5.6.tar.gz
tar xf nginx-1.5.6.tar.gz; cd nginx-1.5.6
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
@websider
websider / intellij-monokai-theme.xml
Created January 24, 2016 15:34 — forked from darekkay/intellij-monokai-theme.xml
Monokai Theme for IntelliJ
<scheme name="Eclectide Monokai" version="124" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="12" />
<option name="EDITOR_FONT_NAME" value="Consolas" />
<colors>
<option name="ADDED_LINES_COLOR" value="295622" />
<option name="CARET_COLOR" value="bbbbbb" />
<option name="CARET_ROW_COLOR" value="" />
<option name="CONSOLE_BACKGROUND_KEY" value="272822" />
<option name="FILESTATUS_ADDED" value="629755" />
@websider
websider / http.php
Created November 29, 2016 03:10
simple http request example in php
<?php
/*
* simple HttpRequest example using PHP
* tom slankard
*/
class HttpRequest {
public $url = null;
@websider
websider / code-1.htm
Created December 1, 2016 08:22 — forked from bennadel/code-1.htm
My Safari Browser SQLite Database Hello World Example
<!DOCTYPE HTML>
<html>
<head>
<title>Safari SQLite Hello World Example</title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
// The first thing we want to do is create the local
// database (if it doesn't exist) or open the connection
// if it does exist. Let's define some options for our
@websider
websider / flask.py
Created June 7, 2018 08:31 — forked from kageurufu/flask.py
Flask-WTF FieldLists with Dynamic Entries
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.wtf import Form
from flask.ext.babel import gettext
from wtforms import SelectField, TelField, TextField, FormField, Fieldlist, SubmitField
from wtforms.validators import Optional, Required
app = Flask(__name__)
db = SQLAlchemy(app)