Skip to content

Instantly share code, notes, and snippets.

View israelshirk's full-sized avatar

Israel israelshirk

  • Boise, Idaho
View GitHub Profile
@israelshirk
israelshirk / 1-drive-ephemeral-only
Last active December 31, 2015 16:58
RAID setup at boot for EBS-ephemeral software raid. Triggered as S01database_raid. 1-drive is set up properly for being a little more forgiving towards failed drives (as long as the script doesn't hang indefinitely); 1-drive-ephemeral-only and 2-drive will fail to add the ephemeral drives to the RAID at mdadm --add.
#!/bin/bash
# /etc/cron.hourly/update-ephemeral-log-template.sh
# Having them recover fast is nice... But having everything stay in sync is better :D
sysctl -w dev.raid.speed_limit_min=40000
sysctl -w dev.raid.speed_limit_max=50000
mkdir -p /var/lib/mysql
@israelshirk
israelshirk / create_chroot_site.sh
Last active October 27, 2017 13:54
Automation script for virtualhosted chrooted installation. Validates inputs, runs make_chroot_jail, generates and tests chroot configuration for php-fpm and nginx, reloads php-fpm and nginx, and templates mysql database
#!/bin/bash
if ! [[ "$0" != "" && "$1" != "" && "$2" != "" ]]; then
read -p "Enter User: " user
read -s -p "Enter DB password: " password
read -p "Enter domains (separate by spaces): " domains
else
user="$1"
password="$2"
domains="$3"
@israelshirk
israelshirk / gist:8077857
Created December 22, 2013 02:43
Extract prices from Photoshelter pricing page
var varsToSelectors = {
size: ["td.groupCat.size", "html"],
name: ["td.name", "html"],
vendor: ["td.vendor", "html"],
'type': ["td.type", "html"],
finishes: ["td.finishes", "html"],
wholesale: ["td.wholesale", "html"],
price: ["td.price input:first", "val"]
}
@israelshirk
israelshirk / gist:9108458
Last active August 29, 2015 13:56
Israel bluehost public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAEAQDCYjEiVc5RFymUs2r2QmMmAo4h0p9fvNHwdmGeewOpK24zCxvALgggzhyU6GOBd8w7I29ENfm7rSQLzyndweTeiah+HJO4Gl3whOg+SwThwSeOgkVOP1wDUVZJVvrqmgQdGAZEW0Lt1tl8+4babbGD0ZsscrNmgAXGEq+DFZP6Kvooi+Ka0RpBn+NAH9MSTdh4NuL1WwetOoPHJTC3vS+JWOlAZes16M6nDf6N+H6/9kDtNxlJOYfiqIe2siOmHvOZ+PpcBGuQ78rxF4eQH3/W3Ro6M13UjbgED3/oziSol+pFBftqCj0l2OLo63YvRVb/wxzUjHgXV4S+ypO6cAqRB+MM9ka7crG++J2XHXLSwejw9ENUsPaAUK2rlq1L2HFsokxsOTVfoM3IMtAPi+/6Fy7NeTFs1ZYfZ/Qd5jaw8MgDFzfmfeA+5TaxlQWwqlIUZWQAoxZWLyJb9MO6PQ1p7W8OJT7jV03gYCP05OIa8lcdOCGmsSMDvfkVlgyORNzH0CzpjI44LbLs33rOEyFW/hEHbiTcIzSAely++7IzbOK9fe+bKAwJWDvE6r2xoiKT1cuFo7c+RSDibc7dE8Ks3irS5mheKojBZCRCg9httNEEuboOedKYO/fFhPlR3FsE5Z6tHBWxgP6IPVVWXgNkgPIWgRnz1vX6+9F4pqpB+4QYXjMqqL0luXab14gjo0lFCFVYGL78NUlEZ7+eRxLyVoU6GbBsDgGKFZ6e28rWhpdQhpPOiioo4vnWUemvVaehGNj86NdrOUMlTPsqwvNb7yXjggS5S3Az74q4+jDODXqamc7d5KT6vK8uG2kFWh9XnrrI9PcfGPu6q1uicnPWHXo5d1Ma1mvnICfeIclWoHhKhxNA5OOGu7SwE0okpHSv1ZH3no3OHbzy+i6C1dVkJy5MTkd1TluC14cwMEDwmpw7/5clkUdbpsaCA8FSBSO6HKiJCjT932+XYYbjaaWU0pIH
@israelshirk
israelshirk / configure_networks.rb
Created March 4, 2014 18:08
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/guests/redhat/cap/configure_networks.rb
require "set"
require "tempfile"
require "vagrant/util/retryable"
require "vagrant/util/template_renderer"
module VagrantPlugins
module GuestRedHat
module Cap
class ConfigureNetworks
@israelshirk
israelshirk / beautifier.php
Last active August 29, 2015 14:02
Quick hack to doctor phpdoc tags. I recommend turning off your default Beautifier settings as well, as they mess with whitespace. You'll want to tweak the indentation and styling in order to use this effectively; I followed up with simple regex batches when using this in order to conform to CakePHP's sniffer standard. Based on solution at http:/…
<?php
// This is intended to govern fixing of stuff and clean up some weird whitespace stuff. Regexes are obviously not the best way to do that (especially given we're interfacing with beautifier...), but works OK for a quick-and-dirty solution.
// I also did a quick-and-dirty modification to the Beautifier's default whitespace filter to prevent it from executing.
require_once 'PHP/Beautifier.php';
$fileName = $argv[1];
if (!file_exists($fileName)) {
@israelshirk
israelshirk / nginx.spec
Last active August 29, 2015 14:02
Fedora 20 Spec file for nginx with nginx-push-stream-module. Push-stream required adding version number variable, Source900, configure switch, and an extra setup line in %build, and asset into SOURCES.
%global _hardened_build 1
%global nginx_user nginx
%global nginx_group %{nginx_user}
%global nginx_home %{_localstatedir}/lib/nginx
%global nginx_home_tmp %{nginx_home}/tmp
%global nginx_confdir %{_sysconfdir}/nginx
%global nginx_datadir %{_datadir}/nginx
%global nginx_logdir %{_localstatedir}/log/nginx
%global nginx_webroot %{nginx_datadir}/html
@israelshirk
israelshirk / aconnection.py
Last active November 17, 2020 16:36
Boto SES + Python Twisted
# Overrides parts of Boto to provide async call/response. Derived from
# SESConnection and boto/connection.
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2011 Harry Marr http://hmarr.com/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
@israelshirk
israelshirk / daemon_wrapper.py
Last active August 29, 2015 14:10
Daemon wrapper for lagging signals
#!/usr/bin/python
import daemon
import grp
import os
import signal
import subprocess
import sys
import time
@israelshirk
israelshirk / docker_deployment_helper.py
Last active August 29, 2015 14:10
Docker container deployment helper
#!/usr/bin/python
import argparse
import docker
import json
import sys
import time
class DockerDeploy:
"""