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
| parser = argparse.ArgumentParser() | |
| group = parser.add_mutually_exclusive_group(required=True) | |
| group.add_argument('--foo', action='store_true') | |
| group.add_argument('--bar', action='store_false') | |
| settings = 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
| def human_format(num): | |
| magnitude = 0 | |
| while abs(num) >= 1000: | |
| magnitude += 1 | |
| num /= 1000.0 | |
| # add more suffixes if you need them | |
| return '%.2f%s' % (num, ['', 'K', 'M', 'G', 'T', 'P'][magnitude]) | |
| print('the answer is %s' % human_format(7436313)) # prints 'the answer is 7.44M' |
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
| from kafka import SimpleProducer, KafkaClient | |
| kafka = KafkaClient('localhost:9092') | |
| producer = SimpleProducer(kafka) | |
| producer.send_messages(b'my-topic', b'some message') | |
| producer.send_messages(b'my-topic', b'this method', b'is variadic') | |
| producer.send_messages(b'my-topic', u'안녕?'.encode('utf-8')) |
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
| nohup node server.js > server.log 2>&1& | |
| echo $! > server_pid.txt |
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
| #!/bin/bash | |
| scriptname &>/dev/null |
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
| #!/bin/bash | |
| function convert_to_mib { | |
| local mib=$1 | |
| if [ $2 = "KB" ] | |
| then | |
| # if less than 1 MiB, just return 1 MiB | |
| mib=1 | |
| fi |
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 docker inspect bwa | python -c "import json; import sys; j=json.loads(sys.stdin.read()); print j[0]['Config']['Labels']" |
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
| rsync -avz -e "ssh -p $portNumber" user@remoteip:/path/to/files/ /local/path/ |
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 python2 | |
| # -*- coding: utf-8 -*- | |
| # tree.py | |
| # | |
| # Written by Doug Dahms | |
| # | |
| # Prints the tree structure for the path specified on the command line | |
| from os import listdir, sep |
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
| npm config set init-author-name="Jaeyoung Chun" | |
| npm config set init-author-email="jaeyoung.chun@gmail.com" |
OlderNewer