Skip to content

Instantly share code, notes, and snippets.

View binary1230's full-sized avatar

Dominic Cerquetti binary1230

View GitHub Profile
@binary1230
binary1230 / nginx-maintenance.conf
Created November 4, 2015 14:11
maintenance page on nginx
# if /var/www/maintenance.html exists, don't use the proxy, instead, redirect everything to the maintenance page
# if it doesn't exist, proceed as normal
server #WHATEVER# {
location #WHATEVER# {
if (-f /var/www/maintenance.html) {
return 503;
}
# REST OF NORMAL STUFF
}
@binary1230
binary1230 / gist:2e0885dbbe861a435bab
Created October 29, 2015 00:15
rams magfest-specific backup script
#!/bin/bash
# backup script for magfest-specific rams instances
# call this function here: https://github.com/magfest/ubersystem-deploy/blob/master/puppet/fabfile.py#L57
BACKUP_DIR=/home/dom/backup
CWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd $CWD/deploy/puppet
function backup_db {
server {
listen *:443 ssl;
server_name example.org;
ssl on;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
ssl_session_cache shared:SSL:10m;
@binary1230
binary1230 / bewbewbew.py
Created August 2, 2015 23:22
play some bews with an arduino and wav file
import serial
import time
import winsound
import http.server
import socketserver
from urllib.parse import urlparse, parse_qs
import text2num
def init_serialport():
global ser
@binary1230
binary1230 / gist:c49ce196d1476e0ae16c
Last active August 29, 2015 14:24
how to setup ghetto AC dev env
EXPERIMENTAL
checkout the 'anthrocon-atd' branch of:
https://github.com/magfest/ubersystem-deploy
do the normal deploy
if needed, add in your stripe keys to the development.ini
then:
This file has been truncated, but you can view the full file.
COMMAND PID TID USER FD TYPE DEVICE SIZE/OFF NODE NAME
init 1 root cwd DIR 253,0 4096 2 /
init 1 root rtd DIR 253,0 4096 2 /
init 1 root txt REG 253,0 265848 393277 /sbin/init
init 1 root mem REG 253,0 47712 402585 /lib/x86_64-linux-gnu/libnss_files-2.19.so
init 1 root mem REG 253,0 47760 393346 /lib/x86_64-linux-gnu/libnss_nis-2.19.so
init 1 root mem REG 253,0 97296 402587 /lib/x86_64-linux-gnu/libnsl-2.19.so
init 1 root mem REG 253,0 39824 402580 /lib/x86_64-linux-gnu/libnss_compat-2.19.so
init 1 root mem REG 253,0 14664 402577 /lib/x86_64-linux-gnu/libdl-2.19.so
init 1 root mem
This file has been truncated, but you can view the full file.
Message: '[08/Jan/2015:23:58:10] HTTP Traceback (most recent call last):\n File "/usr/local/uber13/env/lib/python3.4/site-packages/Django-1.6.1-py3.4.egg/django/template/base.py", line 765, in _resolve_lookup\n current = current[bit]\n File "/usr/local/uber13/env/lib/python3.4/site-packages/Django-1.6.1-py3.4.egg/django/template/context.py", line 56, in __getitem__\n raise KeyError(key)\nKeyError: \'WORKED_OPTS\'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/usr/local/uber13/env/lib/python3.4/site-packages/Django-1.6.1-py3.4.egg/django/template/base.py", line 769, in _resolve_lookup\n if isinstance(current, BaseContext) and getattr(type(current), bit):\nAttributeError: type object \'Context\' has no attribute \'WORKED_OPTS\'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/usr/local/uber13/env/lib/python3.4/site-packages/Django-1.6.1-py3.4.egg/django/templa
@binary1230
binary1230 / gist:a487d7388d50bb42d94c
Created November 4, 2014 21:31
logstash-forwarder config
"network": {
"servers": [ "localhost:5678" ],
"ssl ca": "/etc/ssl/certs/selfsignedCA.crt"
, "ssl certificate": "/etc/ssl/certs/selfsignedHOST.crt" ,"ssl key": "/etc/ssl/certs/selfsignedHOST.key" },
"files": [
{
"paths": [ "/var/log/syslog", "/var/log/messages", "/var/log/secure" ],
"fields": { "type": "syslog" },
@binary1230
binary1230 / gist:74580391d8451e55fba4
Created November 4, 2014 21:20
logstash-forwarder crashing
panic: done
goroutine 5 [running]:
main.func·001()
/mnt/jenkins/workspace/Logstash-Forwarder/logstash-forwarder.go:30 +0x6b
created by main.main
/mnt/jenkins/workspace/Logstash-Forwarder/logstash-forwarder.go:31 +0x13b
goroutine 1 [chan receive]:
main.Registrar(0xc2000b3700)
@binary1230
binary1230 / gist:253a5303ea2eb6102116
Last active January 25, 2016 00:36
setup swap on digitalocean
# make a 4gb swap file named /swapfile and use it
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s