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
# change to zsh | |
chsh -s /bin/zsh | |
# change back to bash | |
chsh -s /bin/bash |
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
Download jpeg lib here: http://www.ijg.org/files/jpegsrc.v7.tar.gz | |
tar -zxvf jpegsrc.v7.tar.gz | |
cd jpeg-7 | |
./configure | |
sudo make clean | |
sudo CC=”gcc -arch i386″./configure –enable-shared –enable-static | |
sudo make |
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
import socket | |
import fcntl | |
import struct | |
def getHwAddr(ifname): | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', ifname[:15])) | |
return ''.join(['%02x:' % ord(char) for char in info[18:24]])[:-1] |
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
sudo apt-get install python-dev | |
sudo apt-get install libxml2-dev | |
sudo apt-get install libxslt-dev | |
sudo pip install lxml |
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
This gist has been converted to a project and moved to here: | |
https://bitbucket.org/zhenyi2697/geocrawler |
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
#!/usr/bin/python | |
import Image | |
new_im = Image.new('RGB', (1280, 1280)) | |
row = 11330 | |
col = 16620 | |
for i in xrange(5): | |
for j in xrange(5): |
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
#!/usr/bin/python | |
import urllib | |
row_start = 11330 | |
col_start = 16620 | |
url_prefix = 'http://wxs.ign.fr/tyujsdxmzox31ituc2uw0qwl/geoportail/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=GEOGRAPHICALGRIDSYSTEMS.MAPS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM&TILEMATRIX=15&' | |
url_appendix = '&extParamId=aHR0cDovL3d3dy5nZW9wb3J0YWlsLmdvdXYuZnIvYWNjdWVpbA==' | |
image_path = '/Users/zhenyi2697/Desktop/cartes' |
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
import argparse | |
parser = argparse.ArgumentParser(description='cbox synchronisation program') | |
group = parser.add_mutually_exclusive_group(required=True) | |
group.add_argument('--vm', action='store', help='Name of the VM', metavar='<NAME>') | |
group.add_argument('--uuid', action='store', help='UUID of the VM', metavar='<VM_UUID>') | |
parser.add_argument('--infoi', action='store', help='Define the new ini file', metavar='<ini_file>') | |
parser.add_argument('--nolog', action='store_true', default=False, help='Disable logging') | |
parser.add_argument('--debug', action='store_true', default=False, help='Enable debug trace') | |
args = parser.parse_args() |
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
#!/usr/bin/python | |
import logging | |
def testLog(DEBUG, LOGFILE): | |
if DEBUG: | |
log_level = logging.DEBUG | |
else: | |
log_level = logging.INFO |
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
# check if it's root who run the script | |
if [ `id -u` != "0" ]; then | |
exit 1 | |
fi |