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
| Windows | |
| copy /b file1+file2 destfile | |
| Linux | |
| cat file1+file2 > destfile |
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/env python | |
| # -*- coding: utf-8 -*-s | |
| from pyPdf import PdfFileWriter, PdfFileReader | |
| from optparse import OptionParser | |
| def mergepdf(outputfile, filestobemerged): | |
| output = PdfFileWriter() | |
| for infile in filestobemerged: | |
| # Read the input PDF file |
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/env python | |
| #-*- coding:utf-8 -*- | |
| from itertools import * | |
| l = [[1, 2], [3, 4]] | |
| print(list(chain(*l))) |
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/env python | |
| # -*- coding: utf-8 -*-s | |
| #http://pythonnewbie.wordpress.com | |
| #/2011/01/12/split-a-list-using-python-zip-function/ | |
| mylist = [1,2,3,4,5,6,7,8,9,10] | |
| j = 5 | |
| print zip(*[iter(mylist)]*j) #prints [(1, 2, 3, 4, 5), (6, 7, 8, 9, 10)] | |
| j = 2 |
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
| openscad -o render.png --imgsize=2048,2048 assembly.scad | |
| convert render.png -resize 512x512 render.png |
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
| class CaseInsensitiveDict(dict): | |
| def __setitem__(self, key, value): | |
| super(CaseInsensitiveDict, self).__setitem__(key.lower(), value) | |
| def __getitem__(self, key): | |
| return super(CaseInsensitiveDict, self).__getitem__(key.lower()) |
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 run_command(command): | |
| process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE) | |
| while True: | |
| output = process.stdout.readline() | |
| if output == '' and process.poll() is not None: | |
| break | |
| if output: | |
| self.logger.info(output.strip()) | |
| rc = process.poll() | |
| return rc |
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
| alias pcalc="python -ic 'from __future__ import division;from math import *,from cmath import *'" |
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 compare(a, b): | |
| return list(frozenset(a).intersection(b)) |
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
| python -c "import SimpleHTTPServer, SocketServer, BaseHTTPServer; SimpleHTTPServer.test(SimpleHTTPServer.SimpleHTTPRequestHandler, type('Server', (BaseHTTPServer.HTTPServer, SocketServer.ThreadingMixIn, object), {}))" 9090 |
NewerOlder