Skip to content

Instantly share code, notes, and snippets.

@phoolish
phoolish / init.lua
Last active September 7, 2025 16:59
Hammerspoon lua script to enable DnD Focus on Mac on lockscreen
--[[
DnD Automation Script for Hammerspoon
Purpose:
Automatically enables Do Not Disturb when the screen is locked and disables it
when unlocked, but only if Hammerspoon was the one that enabled it originally.
This prevents interfering with manually-set DnD preferences.
Requirements:
- Hammerspoon installed and running
@phoolish
phoolish / splitter.sh
Created June 13, 2019 15:51 — forked from steezeburger/splitter.sh
Bash script for splitting large CSV files into 100 lines while keeping the header.
#!/bin/bash
FILENAME=file-to-split.csv
HDR=$(head -1 ${FILENAME})
split -l 100 ${FILENAME} xyz
n=1
for f in xyz*
do
if [[ ${n} -ne 1 ]]; then
echo ${HDR} > part-${n}-${FILENAME}.csv
fi
#!/usr/bin/env bash
set -o xtrace -o errexit -o pipefail -o nounset
########################################################################################
# CircleCI's current recommendation for roughly serializing a subset
# of build commands for a given branch
#
# circle discussion thread - https://discuss.circleci.com/t/serializing-deployments/153
# Code from - https://github.com/bellkev/circle-lock-test
Wed May 31 07:42:00 UTC 2017
@phoolish
phoolish / aws_hvm_ebs_ami.sh
Last active April 19, 2016 00:20
list aws linux hvm ebs ami's
#!/bin/bash
# Requires aws-cli and jq to be installed
#
# Returns the name and ami for each release that matches
aws ec2 describe-images --owners amazon --filters Name=virtualization-type,Values=hvm | jq '[.Images[] | select(.Name | startswith("amzn-ami-hvm")) | select(.Name | endswith("ebs")) | { name: .Name, ami: .ImageId } ] | sort_by(.name)'
@phoolish
phoolish / change_db_owner.sh
Created April 13, 2016 15:38 — forked from gingerlime/change_db_owner.sh
Postgresql - Changing ownership on all tables
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@phoolish
phoolish / keybase.md
Created September 21, 2015 20:51
Keybase proof

Keybase proof

I hereby claim:

  • I am phoolish on github.
  • I am phoolish (https://keybase.io/phoolish) on keybase.
  • I have a public key whose fingerprint is 6CE9 0791 1870 CB7A F412 C279 7D44 37AE 2783 E099

To claim this, I am signing this object:

@phoolish
phoolish / aws_console
Last active August 29, 2015 14:20 — forked from garnaat/gist:10682964
#!/usr/bin/env python
"""
Launch an AWS Web Console.
Usage:
awsconsole launch --role=<role_arn> [--profile=<profile_name>]
Commands:
launch - Launch the AWS Console in your default web browser with
the specified credentials. The console will be authenticated
class NodeUpdateFromFile < ::Chef::Knife
deps do
require "chef/node"
require "chef/json_compat"
require "chef/knife/core/object_loader"
end
banner "knife node update from file FILE (options)"
def loader
@phoolish
phoolish / yum_updates.sh
Created May 22, 2013 14:32
Very basic collectd exec plugin that checks yum for updates and security updates and returns the count
#!/bin/bash
#
# Checks yum for updates and passes the count to collectd.
#
# Requriments:
# - collectd_exec_plugin
# - yum-plugin-security package
#
# <Plugin exec>
# Exec "nobody" "/path/to/yum_update.sh"