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 python3 | |
import subprocess | |
from string import ascii_letters | |
from optparse import OptionParser | |
parser = OptionParser() | |
parser.add_option( | |
"-y", |
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
{ | |
"title": "Launch new Chrome or iTerm2 windows via keybindings", | |
"rules": [ | |
{ | |
"description": "caps lock - launches a new iTerm2 window with the default profile", | |
"manipulators": [ | |
{ | |
"from": { | |
"key_code": "caps_lock", | |
"modifiers": { |
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
# https://www.cloudflare.com/ips/ | |
# this is not meant to catch malformed IPs | |
/(103\.21\.24[4567]\.[0-9]+ # 103.21.244.0/22 | |
|103\.22\.20[0123]\.[0-9]+ # 103.22.200.0/22 | |
|103\.31\.[4567]\.[0-9]+ # 103.31.4.0/22 | |
|104\.(1[6789]|2[0-9]|3[01])\.[0-9]+ # 104.16.0.0/12 | |
|108\.162\.(19[2-9]|2[0-9]+)\.[0-9]+ # 108.162.192.0/18 | |
|131\.0\.7[2345]\.[0-9]+ # 131.0.72.0/22 | |
|141\.101\.(6[4-9]|[7-9][0-9]|1[01][0-9]|12[0-7])\.[0-9]+ # 141.101.64.0/18 |
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
SELECT val, | |
CASE | |
WHEN by5+by3 = 0 THEN 'FizzBuzz' | |
WHEN by5 = 0 THEN 'Fizz' | |
WHEN by3 = 0 THEN 'Buzz' | |
ELSE cast(val AS varchar) | |
END AS fizzbuzz_test | |
FROM | |
(SELECT val, | |
mod(val, 5) AS by5, |
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
pathadd() { | |
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then | |
PATH="$1:${PATH:+"$PATH:"}" | |
fi | |
} | |
# rbenv setup | |
export RBENV_ROOT=/opt/rbenv | |
pathadd /opt/rbenv/bin |
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 | |
num=5 | |
retrycode=99 | |
sleep=300 | |
usage() { | |
cat <<EOF | |
$0 [-r retry_exit_code] [-s sleep_secs] [-n times_to_loop] |
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
# Override Rails.env so we can have a env method that support this environment plus or minus other environments as true | |
# This initializer file is named 01_rails so it executes before any others | |
module Rails | |
# Mini-helper class which subclasses String, duplicating the base of ActiveSupport::StringInquirer | |
# Adds support for comparing hierarchy of environments, the method_name vs. current Rails.env | |
# | |
# Rails.env # => "development" | |
# Rails.env.development? # => true |
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 | |
# | |
# This script surrounds the command passed in with start and finish notifications | |
# to the cronitor monitoring application. | |
# | |
# === SETUP | |
# | |
# * Make sure the cronitor script is executable. | |
# | |
# chmod +x cronitor |
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
# Get logs from other states | |
{% set mylogs = [] %} | |
{% for myfile in salt['cp.list_master']() %} | |
{% if myfile.split('/')[-1] == "log.incl" %} | |
{% include myfile %} | |
{% endif %} | |
{% endfor %} | |
# {{ mylogs }} |
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
# _grains/myenv.py | |
import sys | |
import socket | |
import re | |
import platform | |
# Extend the default list of supported distros. This will be used for the | |
# /etc/DISTRO-release checking that is part of platform.linux_distribution() | |
from platform import _supported_dists |
NewerOlder