Skip to content

Instantly share code, notes, and snippets.

@eby
eby / self.nginxconf
Last active February 21, 2020 19:43
Evergreen Selfcheck Login for Nginx
# Presumes workstations have been created
# Set the homepage of the kiosk browser to selfchecks.mylibrary.org/location
server {
listen 443 ssl http2;
server_name selfchecks.mylibrary.org;
include shared/ssl.conf;
location /branch1 {
allow 192.168.1.0/24;
@eby
eby / ansible-fact.sh
Last active April 26, 2024 17:58
Get OS version for an inventory with ad-hoc ansible
# The setup command allows filtering facts
# More info: https://docs.ansible.com/ansible/latest/modules/setup_module.html
# inventory_file = path to inventory file (if not normal role layout)
# host_group = group to query. use all for all hosts
ansible -i inventory_file host_group -m setup -a 'filter=ansible_distribution_version'
# For a Ubuntu Bionic Host the distribution facts look like this:
# "ansible_distribution": "Ubuntu",
# "ansible_distribution_file_parsed": true,
# "ansible_distribution_file_path": "/etc/os-release",
@eby
eby / service-checklist.md
Created September 23, 2016 20:26 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@eby
eby / reboot.sh
Created September 14, 2016 13:10
Force Remote Reboot
# Same result as hard reset via button so use accordingly
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger
@eby
eby / hpacucli-check.sh
Created April 5, 2016 15:21
Bash script to check HP Smart Array / drive status in cron
#!/bin/bash
###
# FILE: hpacucli-check.sh (03-Dec-2013)
# LICENSE: GNU/GPL v3.0
# AUTHOR: Olaf Reitmaier Veracierta <olafrv@gmail.com>
# USAGE: Check the status of the logical drives on a HP Server
# with hpacucli (HP Array Configuration Utility Client)
# installed, syslog and send an email with errors.
##
@eby
eby / docstore.nginx.conf
Last active March 20, 2016 01:27
Docstore Sample Nginx Config
# Redirect all traffic to SSL
server {
listen [::]:80;
listen 80;
server_name docstore.yourdomain.org;
return 301 https://$server_name$request_uri;
}
# SSL Server based off https://cipherli.st/ and H5BP
server {
# Listen on IPv6/4
@eby
eby / nginx-spamhaus-droplist.sh
Last active September 12, 2017 06:31
cron to download and format spamhaus list for nginx - from:http://www.mybbstuff.com/thread-61.html
#!/bin/bash
# A Nginx Shell Script To Block Spamhaus Lasso Drop Spam IP Address
# Run this script once a day and drop all spam network IPs (netblock) with http 403 client error.
# The script will get executed every day via /etc/cron.daily (make sure crond
# is running).
# -------------------------------------------------------------------------
# Copyright (c) 2008 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
server {
[...]
## Block SQL injections
set $block_sql_injections 0;
if ($query_string ~ "union.*select.*\(") {
set $block_sql_injections 1;
}
if ($query_string ~ "union.*all.*select.*") {
@eby
eby / keybase.md
Created July 6, 2015 21:43
keybase

Keybase proof

I hereby claim:

  • I am eby on github.
  • I am eby (https://keybase.io/eby) on keybase.
  • I have a public key whose fingerprint is D259 4350 9280 4178 1DF4 371E AA61 9E22 65DC D696

To claim this, I am signing this object:

@eby
eby / gist:3be73d59ca21b1c707ac
Last active August 29, 2015 14:22
mcb-power-recent
07/02/2015 21:53:52 System: Coldstart.
07/02/2015 20:05:04 UPS: Switched to battery backup power.
06/23/2015 00:47:30 UPS: Returned from battery backup power.
06/23/2015 00:47:02 UPS: Switched to battery backup power.
06/06/2015 16:15:37 UPS: Returned from battery backup power.
06/06/2015 16:15:32 UPS: Switched to battery backup power.
06/06/2015 14:18:01 UPS: Returned from battery backup power.
06/06/2015 14:18:01 UPS: Switched to battery backup power.
05/11/2015 16:37:05 UPS: Returned from battery backup power.
05/11/2015 16:37:04 UPS: Switched to battery backup power.