This file contains hidden or 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
// | |
// PSPDFThreadSafeMutableDictionary.m | |
// | |
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or 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
static NSString *stringByDecodingURLString(NSString *urlString) | |
{ | |
NSString *string = [urlString stringByReplacingOccurrencesOfString:@"+" | |
withString:@" "]; | |
if (string == nil) { | |
return nil; | |
} | |
return CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapes(kCFAllocatorDefault, | |
(__bridge CFStringRef)string, |
This file contains hidden or 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
# -*- coding:utf-8 -*- | |
import requests | |
from time import sleep | |
from threading import Thread | |
UPDATE_INTERVAL = 0.01 | |
class URLThread(Thread): | |
def __init__(self, url, timeout=10, allow_redirects=True): | |
super(URLThread, self).__init__() |
This file contains hidden or 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/bash | |
#Funciont: Backup website and mysql database | |
#Author: licess | |
#Website: http://lnmp.org | |
#IMPORTANT!!!Please Setting the following Values! | |
bak_dir=/home/backup | |
if [ -d $bak_dir ]; then | |
echo 'begin' |
This file contains hidden or 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
def _thumbnail_image(self, body, size): | |
try: | |
im = Image.open(StringIO(body)) | |
# rotate image according rotation meta of this image | |
# for orientation in ExifTags.TAGS.keys(): | |
# if ExifTags.TAGS[orientation] == 'Orientation' : break | |
orientation = 274 # get 274 through upper loop | |
try: | |
exif = im._getexif() |