Year: 2013

Install GNU gcc 4.8.2 on CentOS 6.4

Install pre-requirements:

Download and extract gcc 4.8.2 source tar ball:

Build and install:

 % make; make install<

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))