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
def orientation(self): | |
exif = self._img._getexif() | |
if exif is None: | |
return 0 | |
orientation = 0x0112 | |
return exif.get(orientation, 0) |
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 | |
class CTImage(object): | |
def rotate(self, degree): | |
self._img = self._img.rotate(degree, expand=True) | |
(self.width,self.height) = self._img.size | |
return self | |
def orientation(self): | |
exif = self._img._getexif() | |
if exif is None: | |
return 0 |
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 ExifTags | |
import Image | |
img = Image.open(filename) | |
print(img._getexif().items()) | |
exif=dict((ExifTags.TAGS[k], v) for k, v in img._getexif().items() if k in ExifTags.TAGS) | |
if not exif['Orientation']: | |
img=img.rotate(90, expand=True) | |
img.thumbnail((1000,1000), Image.ANTIALIAS) | |
img.save(output_fname, "JPEG") |
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
set-option -g prefix ` | |
set-option -g pane-active-border-fg green | |
set-option -g pane-active-border-bg yellow | |
#set-option -g pane-border-fg white | |
set-option -g pane-border-bg black | |
unbind % | |
bind-key s split-window | |
bind-key v split-window -h |
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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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
document.write('<style type="text/css">body{padding); margin:0}</style>'); | |
document.write('<iframe id="iwonder_hack" src="http://' + location.host + '/" width="100%" height="100%" style="border:0;padding:0;margin:0"></iframe>'); | |
setTimeout(function(){ | |
var frmdoc = document.getElementsByTagName('iframe')[0].contentWindow.document | |
,rotation = 0 | |
,links = frmdoc.getElementsByTagName('a') | |
,images = frmdoc.getElementsByTagName('img') | |
,props = ['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform'] | |
,transform = function(elem, trans) { | |
for (var i = 0; i < props.length; i++) { |
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
set completion-ignore-case on | |
set completion-prefix-display-length 2 | |
Control-j: menu-complete | |
Control-k: menu-complete-backward | |
set show-all-if-ambiguous on | |
set show-all-if-unmodified on | |
set completion-map-case on |
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
# install git | |
sudo apt-get install -y g++ curl libssl-dev apache2-utils | |
sudo apt-get install -y git-core | |
mkdir ~/src | |
cd ~/src | |
# download the Node source, compile and install it | |
git clone https://github.com/joyent/node.git | |
cd node |
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 os , shutil | |
rootdir = None | |
try: | |
rootdir = sys.argv[1] | |
except IndexError: | |
print 'Directory not specified. Specify it in the format ' + sys.argv[0] + ' c:\songs' | |
sys.exit() | |
if not os.path.isdir(rootdir): |
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
set ic | |
set lines=75 | |
set history=1000 | |
set incsearch | |
set shell=\"cmd.exe\" | |
set softtabstop=2 | |
set nobomb | |
set nu | |
set smartcase | |
set scrolloff=2 |
NewerOlder