Tag: python

Update salt from 2015.5.3 to 2016.3.2

When reading salt’s source code, it seems we have a ‘source_hash_update’ option on “archive.extracted”, however when I added so, salt complains:

Read More

Crop image in golang

In python, for cropping  image I use PIL. However the dependencies of PIL is huge, also need to install some lib*-dev packages.

So I choose go to crop images:

Usage:

% go run crop.go large.jpeg thumbna

Create file with random string in python

#!/usr/bin/env python
import string
import random

out_file = 'text_file.txt'
file_size = 1024 * 1024

rands = lambda x: ''.join(random.choice(string.letters + string.digits) for x in xrange(x))
with open(out_file, 'w') as f:
f.write(rands(file_size))

Deploy django project to dotCloud

QuickNote: follow the Official guide may not be enough. Read More