This file contains 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
"""Generic linux daemon base class for python 3.x.""" | |
import sys, os, time, atexit, signal | |
class daemon: | |
"""A generic daemon class. | |
Usage: subclass the daemon class and override the run() method.""" | |
def __init__(self, pidfile): self.pidfile = pidfile |
This file contains 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
import os, skimage.io, skimage.exposure, numpy | |
for dir_name, dir_names, filenames in os.walk("/home/jim/Desktop/experiments/141111/kymograph"): | |
for image_name in filenames: | |
filename = "/".join([dir_name, image_name]) | |
original_image = skimage.io.imread(filename) | |
enhanced_image = skimage.exposure.rescale_intensity(original_image, in_range=tuple(numpy.percentile(original_image, (2, 98)))) | |
skimage.io.imsave(filename.split(".")[0] + "_enhanced.png", enhanced_image) |
This file contains 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
# I use this to keep track of things I've done during the day. It's mostly a motivational tool. | |
# I find that the fear of a sparse log at the end of the day drives me to look for things I can | |
# accomplish in a short period of time. | |
# Creating an alias for the script is recommended. | |
# Usage: | |
# $ ./accomplish.sh refactored the robot-targeting code | |
# $ ./accomplish.sh | |
# Fri Aug 27 | refactored the robot-targeting code |
This file contains 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
# first line: | |
# =========== | |
# user/host (red if root, white if not) | |
# number of files in the current directory | |
# total size of files in current directory | |
# second line: | |
# ============ | |
# green benzene symbol if previous command succeeded | |
# solid red hexagon if previous command failed |
This file contains 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
# standard way | |
mysqldump my_db -u root -p | gzip -c | cat > my_db.sql.gz | |
# append a timestamp to the filename | |
mysqldump my_db -u root -p | gzip -c | cat > my_db-$(date +%Y-%m-%d-%H.%M.%S).sql.gz |
This file contains 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
[uwsgi] | |
plugins=python33 | |
socket=/var/uwsgi/uwsgi.myapp.socket | |
pythonpath=/srv/www/myapp | |
uid = www-data | |
gid = www-data | |
chmod-socket = 777 | |
chown-socket = www-data:www-data |
This file contains 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
worker_processes 2; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
sendfile on; | |
keepalive_timeout 3; | |
gzip on; |
This file contains 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
server { | |
listen 80; | |
server_name example.com | |
*.example.com; | |
root /srv/www/myapp; | |
location / { | |
index index.html; | |
} |
This file contains 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 bottle import route, default_app | |
app = application = default_app() | |
app.mount("/api", app) | |
@route('/') | |
def index(): | |
return "Glorious success!" |
This file contains 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
--- | |
# ^^^ YAML documents must begin with the document separator "---" | |
# | |
#### Example docblock, I like to put a descriptive comment at the top of my | |
#### playbooks. | |
# | |
# Overview: Playbook to bootstrap a new host for configuration management. | |
# Applies to: production | |
# Description: | |
# Ensures that a host is configured for management with Ansible. |
OlderNewer