Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
| #!/usr/bin/env python | |
| from datetime import datetime as dt | |
| from datetime import timedelta as td | |
| from calendar import monthrange | |
| import calendar | |
| # Put your birthday here | |
| birthday = dt(1970, 1, 1) |
| # put this in your .bash_profile | |
| if [ $ITERM_SESSION_ID ]; then | |
| export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND"; | |
| fi | |
| # Piece-by-Piece Explanation: | |
| # the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment | |
| # iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too | |
| # the $PROMPT_COMMAND environment variable is executed every time a command is run | |
| # see: ss64.com/bash/syntax-prompt.html |
| #!/usr/bin/env python | |
| """ | |
| Very simple HTTP server in python. | |
| Usage:: | |
| ./dummy-web-server.py [<port>] | |
| Send a GET request:: | |
| curl http://localhost |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| # If /json route receives header "application/json" | |
| @app.route("/json", methods=['GET','POST']) | |
| def json(): | |
| app.logger.debug("JSON received...") | |
| app.logger.debug(request.json) | |
| if request.json: | |
| mydata = request.json # will be |
| ## you may need sudo permission to execute some commands or swith to root | |
| # if installed old version by yum, remove it first | |
| sudo yum remove tmux libevent libevent-devel libevent-headers | |
| # install deps | |
| sudo yum install gcc kernel-devel make ncurses-devel | |
| # create temp dir | |
| mkdir /tmp/for-latest-tmux |
| var request = require('request'); | |
| var unzip = require('unzip'); | |
| var csv2 = require('csv2'); | |
| request.get('http://s3.amazonaws.com/alexa-static/top-1m.csv.zip') | |
| .pipe(unzip.Parse()) | |
| .on('entry', function (entry) { | |
| entry.pipe(csv2()).on('data', console.log); | |
| }) | |
| ; |
| def is_prime?(n) | |
| bits = 8.times.map { |i| n[i] } | |
| [[[-8.8, 3.0, 9.2, 5.0, -4.8, 5.6, -5.8, 6.1, -6.1], | |
| [-1.8, 2.3, -2.6, -5.6, 0.1, 6.0, -4.7, -5.7, -3.0], | |
| [-3.6, -4.1, 6.5, -0.6, -2.8, -2.6, 2.4, -2.3, 1.0], | |
| [ 2.4, -9.1, -3.1, 7.8, -3.7, -8.9, -2.8, 5.6, 6.3], | |
| [-2.0, 4.0, 11.0, 3.3, -6.0, 0.7, -7.0, 1.6, -3.0], | |
| [ 0.7, -7.2, 2.8, 4.5, -3.6, -1.5, 2.7, -0.1, -3.5], | |
| [-8.9, 5.5, 4.8, -4.1, 5.6, 4.8, 5.5, -4.0, -6.4], | |
| [-4.0, -6.7, -3.6, 5.5, 2.5, -6.9, 7.8, -4.1, -0.4], |
| {"墨鏡":{"emoji":["😎"]}, | |
| "泰國":{"emoji":["🇹🇭"]}, | |
| "南苏丹共和国":{"emoji":["🇸🇸"]}, | |
| "让利":{"emoji":["🈹️"]}, | |
| "男性":{"emoji":["🚹"]}, | |
| "向日葵":{"emoji":["🌻"]}, | |
| "營":{"emoji":["🈺️"]}, | |
| "斯里兰卡":{"emoji":["🇱🇰"]}, | |
| "兔子脸":{"emoji":["🐰"]}, | |
| "虫子":{"emoji":["🐛","🐜"]}, |