This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Convert structured Ruby credentials to JSON that can be easily copy/pasted | |
# into an EJSON secrets file. | |
# | |
# Usage: | |
# | |
# rails credentails:show --environment staging | ./conv.rb | |
require 'yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
firewall { | |
name GUEST_IN { | |
default-action accept | |
description "packets from guest network" | |
rule 1000 { | |
action accept | |
description "allow DNS to pihole" | |
destination { | |
address 10.65.49.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
tmpfile="${TMPDIR}sys_bluetooth_$(date +%s).plist" | |
# dump data to temp plist file | |
/usr/sbin/system_profiler -xml SPBluetoothDataType > "$tmpfile" | |
# read battery percentage from tempfile and delete percent sign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# deps | |
pip2 install websocket-client | |
# weechat itself | |
brew install weechat --with-aspell --with-python@2 | |
# wee-slack | |
mkdir -p ~/.weechat/python/autoload | |
curl -o ~/.weechat/python/autoload/wee_slack.py https://raw.githubusercontent.com/wee-slack/wee-slack/master/wee_slack.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When adding or subtracting DateTime objects, the return type is a Rational expressing the fraction of a day's number of minutes (1440). So 0.5 would mean half a day, or 720 minutes, or 12 hours. | |
# When adding or subtracting Time objects, the return type is Float expressing the difference in seconds. | |
#Here's an example showing the difference between two times that are an hour apart: | |
MINUTES_IN_A_DAY = 1440 | |
ref1 = "2018-03-13T08:00:00+00:00" | |
ref2 = "2018-03-13T09:00:00+00:00" | |
# -3600 = 3600 seconds ago, i.e. 1 hour ago | |
Time.zone.iso8601(ref1) - Time.zone.iso8601(ref2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group :development, :test do | |
# Call 'byebug' anywhere in the code to stop execution and get a debugger console | |
gem 'byebug', platform: :mri | |
# Spec testing | |
gem 'rspec-rails' | |
# Code coverage analysis | |
gem 'simplecov', require: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# If your system crashes or shuts-down hard, the PostgreSQL PID file is left | |
# behind and then it won't startup when your system restarts. Run this script | |
# to check if it's ok to delete the PID file and start PostgreSQL | |
prefix=$(brew --prefix) | |
pid_path="$prefix/var/postgres/postmaster.pid" | |
if [ ! -f "$pid_path" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Disable Challenge-Response authentication | |
lineinfile: | |
dest=/etc/ssh/sshd_config | |
regexp="^ChallengeResponseAuthentication" | |
line="ChallengeResponseAuthentication no" | |
state=present | |
notify: restart ssh | |
# OR |