esc: exit current user input context.
shift+/: open help modal
←: move left
→: move right
| int unbiased_random_bit() { | |
| int x1, x2, prev; | |
| prev = 2; | |
| x1 = rand() % 2; | |
| x2 = rand() % 2; | |
| for (;; x1 = rand() % 2, x2 = rand() % 2) | |
| { | |
| if (x1 ^ x2) // 01 -> 1, or 10 -> 0. | |
| { |
| LIBVIPS_FULL_VERSION=7.40.2 | |
| LIBVIPS_MAJOR_VERSION=echo $LIBVIPS_VERSION | sed 's/v//g' | sed 's/[^.]*$//' | sed 's/[.| ]*$//g' | |
| curl -o vips-build.tar.gz http://www.vips.ecs.soton.ac.uk/supported/$LIBVIPS_MAJOR_VERSION/vips-$LIBVIPS_FULL_VERSION.tar.gz | |
| mkdir vips-build && tar -xf vips-build.tar.gz -C vips-build --strip-components=1 | |
| cd vips-build | |
| ./configure | |
| make && sudo make install | |
| export LD_LIBRARY_PATH=/usr/local/lib | |
| export LD_RUN_PATH=/usr/local/lib |
esc: exit current user input context.
shift+/: open help modal
←: move left
→: move right
| #!/usr/bin/python2.7 | |
| import subprocess | |
| import os | |
| import sys | |
| from tempfile import NamedTemporaryFile | |
| with NamedTemporaryFile('w', delete=False) as fout: | |
| fout.write('import sys; print sys.stdin') | |
| print subprocess.check_output(['python2.7', fout.name], stdin=sys.stdin) |
| class ErrorHandler (logging.Handler): | |
| def __init__(self): | |
| logging.Handler.__init__(self) | |
| self.lock = multiprocessing.Lock() | |
| self.errorLogMessages = list() | |
| def emit (self, record): | |
| print record | |
| self.lock.acquire() | |
| print "lock acquired" | |
| try: |
| uglify: { | |
| development: { | |
| options: { | |
| banner: '/*! Development <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n', | |
| mangle: false, | |
| compress: false, | |
| preserveComments: 'all', | |
| beautify: true | |
| }, | |
| all: { |
| from PIL import Image | |
| from PIL import ImageFilter | |
| pageImage = Image.open('sample.tiff') | |
| pageImage = pageImage.convert('L') | |
| pageImage.info['compression']='raw' | |
| pageImage=pageImage.filter(ImageFilter.GaussianBlur(4)) | |
| pageImage.save('/out/sample.tiff') |
| import custom_logger | |
| import logging | |
| import logging.handlers | |
| class Runner (): | |
| def __init__(self): | |
| pass | |
| def run(self): | |
| #logging.basicConfig(filename="Task.log",filemode='w', fmt = '%(asctime)s - %(levelname)s - %(module)s - %(message)s',datefmt = '%m/%d/%Y %I:%M:%S %p', level=logging.DEBUG) |
| app.post('/postParams/:message/:description/:id', function(){ | |
| console.dir(req.query); | |
| }); | |
| //nothing happens when trying to query | |
| //http://localhost:8080/postParams?message=hello&description=desc&id=1 |