Note that this requires the following alias set in $HOME/.gitconfig
:
[alias]
tree = "!f() { git log $@ --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit ; }; f"
Note that this requires the following alias set in $HOME/.gitconfig
:
[alias]
tree = "!f() { git log $@ --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit ; }; f"
To deploy your app, you'll need to install Ansible and the Ansistrano deploy and rollback Ansible Galaxy roles.
Then create a directory in your app (eg. named ansible
) and put these files in there. You should only need to modify the top few variables in vars.yml
to get the deployment working for your app.
To do the deployment, use a command like this:
ansible-playbook --limit ansible/deploy.yml
echo "The following MySQL database tables are corrupt:" | |
mysql -Nse "show databases" | while read database ; do | |
mysql -Nse "show tables from $database" | while read table ; do | |
test=`mysql -e "select * from ${database}.${table} limit 1" 2> /dev/null` | |
if [[ $? -ne 0 ]] ; then | |
echo "${database}.${table}" | |
fi | |
done | |
done |
_complete_source_activate_conda() | |
{ | |
if [ ${COMP_WORDS[COMP_CWORD-1]} != "activate" ] ; then | |
return 0 | |
fi | |
local cur env_list | |
cur=${COMP_WORDS[COMP_CWORD]} | |
env_list=$(conda env list | sed '1d;2d;$d' | awk {'print $1'}) | |
COMPREPLY=( $(compgen -W "${env_list[@]}" -- "$cur") ) | |
} |
#!/usr/bin/env python | |
from subprocess import call, PIPE | |
import os | |
user = '<user>' | |
vpn_servers = ['<server1>', '<server2>'] | |
for vpn_server in vpn_servers: |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Image Browser</title> | |
<style> | |
img[name=image] { | |
max-width: 100%; | |
height: auto; | |
} | |
</style> |
#!/usr/bin/env python | |
import os, sys | |
import pkgutil | |
def list_submodules(list_name, package_name): | |
for loader, module_name, is_pkg in pkgutil.walk_packages(package_name.__path__, package_name.__name__+'.'): | |
list_name.append(module_name) | |
module_name = __import__(module_name, fromlist='dummylist') | |
if is_pkg: |
#!/bin/sh | |
#--------------------------------------------------------------------------------------------------- | |
# Usage | |
# | |
usage() { | |
printf "$(basename "$0") -s <TIME_BETWEEN_TRIES> -t <TIME_TO_TRY> <COMMAND>\n" | |
printf " where:\n" | |
printf " -s TIME_BETWEEN_TRIES time (minutes) between each try\n" | |
printf " -t TIME_TO_TRY total time (minutes) to try the command before giving up\n" |
Create a file z.pth
in your virtual env's site-packages
dir (eg. ~/.conda/envs/<env-name>/lib/python3.5/site-packages
) containing this line:
import pkg_resources; pkg_resources.fixup_namespace_packages('')