Skip to content

Instantly share code, notes, and snippets.

View coryodaniel's full-sized avatar
☘️
O'Internets

Cory O'Daniel coryodaniel

☘️
O'Internets
View GitHub Profile
@coryodaniel
coryodaniel / .pre-commit-hooks.yaml
Last active July 9, 2022 22:43 — forked from athiththan11/pre-commit
Git Pre Commit Hook for FIXME TODO
- id: deny-todos
name: Denies TODOs or FIXME
description: 'Denies TODOs or FIXME in commits'
entry: run.sh
language: script
@coryodaniel
coryodaniel / scanner.sh
Created March 10, 2020 03:32 — forked from andyrbell/scanner.sh
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@coryodaniel
coryodaniel / deployment.yml
Created February 1, 2019 02:04 — forked from troyharvey/deployment.yml
Using Kubernetes envFrom for environment variables
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
@coryodaniel
coryodaniel / Makefile
Created July 18, 2018 23:20 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@coryodaniel
coryodaniel / validate-nginx-config.sh
Created July 18, 2018 14:48 — forked from jadkik/validate-nginx-config.sh
Used to validate nginx templated config files before actually using them. For use with Ansible.
#!/usr/bin/env bash
# Example usage from an Ansible playbook:
# - name: Copy the nginx validate script
# copy: src=validate-nginx-config.sh dest=/opt/validate-nginx-config.sh mode=0744
#
# - name: Update main nginx config file
# template:
# src: nginx.conf.j2
# dest: /etc/nginx/nginx.conf
## convert HTML POST data or HTTP GET query string to JSON
## get the raw post data from the AWS built-in variable and give it a nicer name
#if ($context.httpMethod == "POST")
#set($rawAPIData = $input.path("$"))
#elseif ($context.httpMethod == "GET")
#set($rawAPIData = $input.params().querystring)
#set($rawAPIData = $rawAPIData.toString())
#set($rawAPIDataLength = $rawAPIData.length() - 1)
#set($rawAPIData = $rawAPIData.substring(1, $rawAPIDataLength))
@coryodaniel
coryodaniel / es_index_maintenance.js
Created June 29, 2017 21:47 — forked from devoncrouse/es_index_maintenance.js
Elastic Search maintenance script for periodic indices. Manages optimization/write-protection/closure/removal of indices based on age (derived from index naming convention) and status.
#!/usr/bin/env node
// Configuration
var argv = require('optimist')
.usage('Usage: $0 --prefix index_prefix [options]')
.demand(['prefix'])
.describe({
host: 'Elastic Search host',
port: 'Elastic Search port',
secure: 'Use secure Elastic Search connection',
@coryodaniel
coryodaniel / labels.yaml
Last active June 9, 2017 23:55 — forked from omegahm/create_labels.sh
Github Labels
# https://github.com/tonglil/labeler
repo: coryodaniel/my-repo-yo
labels:
#- name: ruby
# color: BFD4F2
- name: elixir
color: BFD4F2
- name: nodejs
color: BFD4F2
#- name: rails
@coryodaniel
coryodaniel / file.sql
Created October 17, 2016 01:06 — forked from emmanuel/file.sql
Closure Table operations SQL fragments
-- Retrieve descendants
-- ====================
-- retrieve descendants of #4
SELECT c.*
FROM Comments AS c
JOIN TreePaths AS t ON c.comment_id = t.descendant
WHERE t.ancestor = 4;
-- Retrieve ancestors