Skip to content

Instantly share code, notes, and snippets.

View cuibonobo's full-sized avatar

Jen Garcia cuibonobo

View GitHub Profile
@cuibonobo
cuibonobo / half-size-booklet.sh
Last active January 24, 2023 20:36
Process a PDF to allow for half-size booklet printing
# Get the number of pages in the PDF. (On a Mac you can do `pages=$(mdls -raw -name kMDItemNumberOfPages $PDF)`)
pages=$(pdftk $PDF dump_data | grep NumberOfPages | awk '{print $2}')
# Get the number of 16-page booklets
booklets=$(($pages/16))
if [[ $(($pages%16)) -gt 0 ]]; then
booklets=$(($booklets+1))
fi
# Determine where to split the book for the half-size
booksplit=$(($booklets/2))
# Determine at what page to split the book
@cuibonobo
cuibonobo / documentation.html
Last active May 23, 2021 20:49
A simple documentation boilerplate
<html>
<head>
<title>Documentation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/purecss@0.6.1/build/base-min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mermaid/6.0.0/mermaid.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/atom-one-light.min.css">
<style type="text/css">
body {
@cuibonobo
cuibonobo / CVE-2016-2107_Centos_7_fix.sh
Created October 18, 2016 15:34
How to fix CVE-2016-2107 on an Nginx server in Centos 7
#!/bin/bash
# You need this for your OpenSSL tests to pass later
yum install perl-core
# Grab the source for OpenSSL 1.1, which has the patch for CVE-2016-2107
cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.0b.tar.gz
tar -zxf openssl-1.1.0b.tar.gz
cd openssl-1.1.0b
@cuibonobo
cuibonobo / split_repo.sh
Created September 25, 2016 00:25
Splitting a repo (on git versions 1.7.11+, this is done with git subtree)
#/bin/bash
git clone unicorn unicorn-calendar
cd unicorn-calendar
git filter-branch --prune-empty --subdirectory-filter apps/calendar master
git reset --hard
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
git gc --aggressive --prune=now
git remote rm origin
@cuibonobo
cuibonobo / configure-mailgun
Created September 6, 2016 15:13 — forked from jgeewax/configure-mailgun
Script to configure Postfix for Mailgun
#!/bin/bash
# Configuration for the script
POSTFIX_CONFIG=/etc/postfix/main.cf
POSTFIX_SASL=/etc/postfix/sasl_passwd
function confirm () {
read -r -p "${1:-Are you sure? [Y/n]} " response
if [[ $response == "" || $response == "y" || $response == "Y" ]]; then
echo 0;
@cuibonobo
cuibonobo / mysql_setup.md
Last active September 6, 2016 11:38
Creating a new user in MySQL and granting it privileges to a database.
@cuibonobo
cuibonobo / fix-wordpress-permissions.sh
Last active August 28, 2016 06:18 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=haverstack # <-- wordpress owner
WP_GROUP=haverstack # <-- wordpress group
WP_ROOT=data # <-- wordpress root directory
@cuibonobo
cuibonobo / centos7_docker_compose.sh
Last active August 28, 2016 02:51
Getting Docker Compose running on a minimum install CentOS 7
#!/bin/bash
# Install Docker
curl -L -s https://get.docker.com/ | sh
# Add the user that will be working with Docker to the docker group
usermod -aG docker jen
# Start the Docker service
systemctl start docker.service
@cuibonobo
cuibonobo / centos7_setup.sh
Last active August 28, 2016 01:49
The bare-minimum that needs to be run when you first switch on a CentOS 7 VPS.
#!/bin/bash
# Update the system
yum update -y
# Add a non-root user
adduser jen
passwd jen
gpasswd -a jen wheel
@cuibonobo
cuibonobo / sidebar
Created July 10, 2016 21:48 — forked from shilman/sidebar
proxy_cache_path /var/cache/nginx/sidebar levels=1:2 keys_zone=SIDEBAR:10m inactive=24h max_size=1g;
upstream sidebar {
ip_hash;
server xxx.xxx.xx.xxx:80;
server yyy.yyy.yy.yyy:80;
}
server {