This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
from PIL.ExifTags import TAGS, GPSTAGS | |
def get_exif_data(image): | |
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags""" | |
exif_data = {} | |
info = image._getexif() | |
if info: | |
for tag, value in info.items(): | |
decoded = TAGS.get(tag, tag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# kestrel init.d script. | |
# | |
# All java services require the same directory structure: | |
# /usr/local/$APP_NAME | |
# /var/log/$APP_NAME | |
# /var/run/$APP_NAME | |
APP_NAME="kestrel" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
import dns.resolver # Requires dnspython | |
email_host_regex = re.compile(".*@(.*)$") | |
gmail_servers_regex = re.compile("(.google.com.|.googlemail.com.)$", re.IGNORECASE) | |
def is_gmail(email): | |
""" Returns True if the supplied Email address is a @gmail.com Email or is a Google Apps for your domain - hosted Gmail address | |
Checks are performed by checking the DNS MX records """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import time | |
from boto.s3.connection import S3Connection | |
from boto.exception import S3ResponseError | |
def run(args): | |
s3_connection = S3Connection(args.aws_access_key, args.aws_secret_access_key) | |
source_bucket = s3_connection.get_bucket(args.source_bucket) | |
destination_bucket = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)resizedImage:(CGSize)newSize interpolationQuality:(CGInterpolationQuality)quality { | |
BOOL drawTransposed; | |
CGAffineTransform transform = CGAffineTransformIdentity; | |
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0) { | |
// Apprently in iOS 5 the image is already correctly rotated, so we don't need to rotate it manually | |
drawTransposed = NO; | |
} else { | |
switch (self.imageOrientation) { | |
case UIImageOrientationLeft: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require("crypto") | |
function encrypt(key, data) { | |
var cipher = crypto.createCipher('aes-256-cbc', key); | |
var crypted = cipher.update(data, 'utf-8', 'hex'); | |
crypted += cipher.final('hex'); | |
return crypted; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cities = [{label:"א דהאבשה", value:"124"}, | |
{label:"א דיראת", value:"122"}, | |
{label:"א דנפירי", value:"205"}, | |
{label:"א זיאדנה דרומית לרהט", value:"179"}, | |
{label:"א זיאדנה צפונית לרהט", value:"179"}, | |
{label:"א זעיים", value:"96"}, | |
{label:"א טבקה", value:"122"}, | |
{label:"א טוואני", value:"122"}, | |
{label:"א לובאן", value:"92"}, | |
{label:"א נבארי", value:"199"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path to boto config file, needed by gsutils | |
BOTO_CONFIG="/etc/boto.cfg" | |
# Path in which to create the backup (will get cleaned later) | |
BACKUP_PATH="/mnt/data/dump/" | |
# DB name | |
DB_NAME="mydatabase" | |
# Google Cloud Storage Bucket Name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/jinzhu/gorm" | |
_ "database/sql" | |
_ "github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/dialers/mysql" | |
) | |
// You can read more in this post: http://forecastcloudy.net/2016/06/28/using-google-cloud-sql-from-go-with-gorm-in-google-container-engine-and-google-compute-engine/ | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
type container struct { | |
Name string | |
Value interface{} |
OlderNewer