Skip to content

Instantly share code, notes, and snippets.

View jimrybarski's full-sized avatar
🤖

Jim Rybarski jimrybarski

🤖
View GitHub Profile
@jimrybarski
jimrybarski / .bashrc
Last active December 19, 2015 10:29
My command prompt
# 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
@jimrybarski
jimrybarski / mysqldump_and_compress.sh
Created July 21, 2013 14:36
One liner to dump MySQL database and compress on the fly
# 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
@jimrybarski
jimrybarski / uwsgi.ini
Last active December 22, 2015 18:29
uWSGI configuration
[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
@jimrybarski
jimrybarski / nginx.conf
Created September 10, 2013 17:53
Nginx configuration
worker_processes 2;
events {
worker_connections 1024;
}
http {
sendfile on;
keepalive_timeout 3;
gzip on;
@jimrybarski
jimrybarski / myapp
Last active December 22, 2015 18:29
Nginx site configuration
server {
listen 80;
server_name example.com
*.example.com;
root /srv/www/myapp;
location / {
index index.html;
}
@jimrybarski
jimrybarski / myapp.py
Created September 10, 2013 17:59
The main Bottle file
from bottle import route, default_app
app = application = default_app()
app.mount("/api", app)
@route('/')
def index():
return "Glorious success!"
---
# ^^^ 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.
#!/bin/bash
SECURE_MYSQL=$(expect -c "
set timeout 10
spawn mysql_secure_installation
expect \"Enter current password for root (enter for none):\"
send \"\r\"
@jimrybarski
jimrybarski / bad_map.py
Last active January 2, 2016 14:09
One of the worst pieces of code ever
""" I did not write this, though I fixed a syntax error in it. I just found it while looking for an easy way to plot a world choropleth map. It is probably the worst program I've ever seen and felt I should keep it for some reason. """
import shapefile
import matplotlib.cm as jimbo
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
import numpy as np
@jimrybarski
jimrybarski / inventory
Created January 28, 2014 17:51
Ansible inventory with ipv6 address that does not work correctly
[blank]
2001:4800:7816:0517:8b5b:f2a3:ff04:4f29