Skip to content

Instantly share code, notes, and snippets.

@luapz
luapz / backup.sh
Created July 31, 2011 14:24 — forked from comfuture/backup.sh
backup daily to remote host, and delete old backups smarter
#!/bin/bash
date=`date "+%Y-%m-%dT%H_%M_%S"`
HOME=/YOUR/LOCALHOME
SERVER=ID@HOST
DIR=backup
rsync -azP \
--bwlimit=500 \
--delete \
--delete-excluded \
@luapz
luapz / DBStorageStream.php
Created November 27, 2011 15:22 — forked from comfuture/DBStorageStream.php
using database as filesystem
<?php
class DBStorageStream
{
const DDL = <<<EOF
CREATE TABLE IF NOT EXISTS `table_dbfs` (
`path` VARCHAR(255) NOT NULL PRIMARY KEY,
`data` LONGTEXT,
`is_dir` CHAR(1) NOT NULL DEFAULT 'N',
`created_at` DATETIME,
@luapz
luapz / backup.sh
Created August 12, 2012 15:08 — forked from comfuture/backup.sh
backup daily to remote host, and delete old backups smarter
#!/bin/bash
date=`date "+%Y-%m-%dT%H_%M_%S"`
HOME=/YOUR/LOCALHOME
SERVER=ID@HOST
DIR=backup
rsync -azP \
--bwlimit=500 \
--delete \
--delete-excluded \
@luapz
luapz / gist:4564694
Created January 18, 2013 13:56
Sending Emails Via Gmail SMTP With Python
#!/usr/bin/python
import smtplib
SMTP_SERVER = 'smtp.gmail.com'
SMTP_PORT = 587
sender = '[email protected]'
recipient = '[email protected]'
subject = 'Gmail SMTP Test'
body = 'blah blah blah'
#!/usr/bin/env python
import sys, os
import hashlib
import zipfile
VENDORS = {
# vendor desc : vendor id
'Google Inc.' : 'google',
'LG Electronics' : 'lge',
'Intel Corporation': 'intel_corporation',
@luapz
luapz / detect.py
Created February 2, 2013 14:30 — forked from LeZuse/detect.py
browser = request.user_agent.browser
version = request.user_agent.version and int(request.user_agent.version.split('.')[0])
platform = request.user_agent.platform
uas = request.user_agent.string
if browser and version:
if (browser == 'msie' and version < 9) \
or (browser == 'firefox' and version < 4) \
or (platform == 'android' and browser == 'safari' and version < 534) \
or (platform == 'iphone' and browser == 'safari' and version < 7000) \
# -*- python -*-
# vim: ts=4 sw=4 sts=4 expandtab syntax=python
# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory.
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
import os
__basedir__ = os.path.abspath(os.path.dirname(__file__))
@luapz
luapz / form.py
Created April 9, 2013 15:14 — forked from dahlia/form.py
from flask import current_app, request, url_for
from formencode.htmlfill import render
from formencode.api import Invalid
from jinja2 import Markup, Undefined
from jinja2.exceptions import TemplateSyntaxError
from jinja2.ext import Extension
from jinja2.nodes import (Const, Filter, FilterBlock, Keyword, Output,
TemplateData)
from werkzeug.utils import escape
@luapz
luapz / client.py
Last active August 29, 2015 14:10 — forked from micktwomey/client.py
import socket
if __name__ == "__main__":
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 9000))
data = "some data"
sock.sendall(data)
result = sock.recv(1024)
print result
sock.close()
#!/usr/bin/env python2
# coding: utf-8
from __future__ import print_function
import os
import sys
from wand.image import Image
DIMENSIONS = {
'OSX': [
('icon_16x16.png', 16),