As configured in my dotfiles.
start new:
tmux
start new with session name:
As configured in my dotfiles.
start new:
tmux
start new with session name:
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| #!/usr/bin/env bash | |
| # Runs all .json or .js files through pythons json lint tool before commiting, | |
| # to make sure that you don't commit broken json objects. | |
| git_dir=$(git rev-parse --show-toplevel) | |
| for file in $(git diff-index --name-only --diff-filter=ACM --cached HEAD -- \ | |
| | grep -P '\.((js)|(json))$'); do | |
| python -mjson.tool $file 2> /dev/null | |
| if [ $? -ne 0 ] ; then |
I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).
In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.
An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.
Here's how it should work:
| #!/bin/bash | |
| # | |
| # This script should do: | |
| # | |
| # 1) test if nfs folder is mounted and exit 0 if yes | |
| # 2) try to mount it and exit 0 if success | |
| # 3) try to wake the server if not possible to mount | |
| # 4) wait while its not woked (pinging) | |
| # 5) try againt 2-4 several times |
| """An example of a cache decorator.""" | |
| import json | |
| from functools import wraps | |
| from redis import StrictRedis | |
| redis = StrictRedis() | |
| def cached(func): |
| '''Train a Siamese MLP on pairs of digits from the MNIST dataset. | |
| It follows Hadsell-et-al.'06 [1] by computing the Euclidean distance on the | |
| output of the shared network and by optimizing the contrastive loss (see paper | |
| for mode details). | |
| [1] "Dimensionality Reduction by Learning an Invariant Mapping" | |
| http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf | |
| Run on GPU: THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python mnist_siamese_graph.py |
| from tqdm import tqdm | |
| import requests | |
| chunk_size = 1024 | |
| url = "http://www.nervenet.org/pdf/python3handson.pdf" | |
| r = requests.get(url, stream = True) | |
| total_size = int(r.headers['content-length']) |
| #!/bin/bash | |
| # install CUDA Toolkit v9.0 | |
| # instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb) | |
| CUDA_REPO_PKG="cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb" | |
| wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/${CUDA_REPO_PKG} | |
| sudo dpkg -i ${CUDA_REPO_PKG} | |
| sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | |
| sudo apt-get update | |
| sudo apt-get -y install cuda-9-0 |