Skip to content

Instantly share code, notes, and snippets.

View sambauers's full-sized avatar
🧑‍💻

Sam Bauers sambauers

🧑‍💻
View GitHub Profile
@sambauers
sambauers / memcache_empty.sh
Last active August 2, 2016 04:07
Empties memcached completely, including flushed keys.
#!/usr/bin/env bash
# Edit these to your liking
IP="127.0.0.1";
PORT="11211";
# Warn the user
printf "This will flush all keys and delete them as well. This action can NOT be reversed.\\n";
printf "Are you sure you want to do this?\\n";
select answer in "Yes" "No" ; do
@sambauers
sambauers / .profile-emoji-digr.sh
Last active April 6, 2017 07:18
Does a reverse lookup on a domain name's IP address and adds emoji, because emoji.
# Add this file to your home directory then include it in ~/.profile using `. ~/.profile-emoji-digr.sh`
digr() {
# These will show up in an emoji compatible terminal
DIGR_EMOJI=(🍏 🍎 🍐 🍊 🍋 🍌 🍉 🍇 🍓 🍈 🍒 🍑 🍍 🥝 🥑 🍅);
for arg; do
RANDOM_DIGR_EMOJI=${DIGR_EMOJI[$((RANDOM%14))]};
echo "${RANDOM_DIGR_EMOJI##*/} $arg";
for DIGR_IP in $(dig +short $arg); do
echo -e " \033[38;5;244m↳ \033[0m" $DIGR_IP;
@sambauers
sambauers / .profile-emoji-me.sh
Last active November 19, 2021 15:59
Adds random emoji to your terminal prompt on Mac OS X, because emoji.
# Add this file to your home directory then include it in ~/.profile using `. ~/.profile-emoji-me.sh`
# These will show up in an emoji compatible terminal
ME_EMOJI=(🐶 🐱 🐭 🐹 🐰 🦊 🐻 🐼 🐨 🐯 🦁 🐮 🐷 🐸 🐵 🐙);
RANDOM_ME_EMOJI=${ME_EMOJI[$((RANDOM%14))]};
export PS1="\h:\W \u $RANDOM_ME_EMOJI ";
export PROMPT_COMMAND='update_terminal_cwd; echo -ne "\033]0;${RANDOM_ME_EMOJI##*/}\007"';
@sambauers
sambauers / .profile-digr.sh
Last active July 12, 2016 04:34
Does a reverse lookup on a domain name's IP address.
# Add this file to your home directory then include it in ~/.profile using `. ~/.profile-digr.sh`
digr() {
for arg; do
echo -e "\033[38;5;244m*\033[0m $arg";
for DIGR_IP in $(dig +short $arg); do
echo -e " \033[38;5;244m↳ \033[0m" $DIGR_IP;
done;
if [[ "$DIGR_IP" != "" ]]; then
for DIGR_PTR in $(dig +short -x $DIGR_IP); do
@sambauers
sambauers / kill-jira-watchlist.php
Last active August 29, 2015 14:08
Grabs all your watched JIRAs and removes your watch on them… very slowly.
<?php
$username = urlencode('your_jira_username');
$password = urlencode('your_jira_password');
$jiraurl = 'https://your_jira_url'; // e.g. https://redant.jira.com
$json = file_get_contents("$jiraurl/rest/api/latest/search?os_username=$username&os_password=$password&jql=issuekey%20in%20watchedIssues()&maxResults=1000");
if ( $json ) {
$data = json_decode($json);
@sambauers
sambauers / toolbar-slip.html
Last active August 29, 2015 14:09
Add a solid rainbow background to the OS X Yosemite Safari toolbar (on scroll)
<!DOCTYPE html>
<html>
<head>
<style>
.toolbar-slip {
position: fixed;
top: -600px;
left: 0;
height: 600px;
width: 100%;
@sambauers
sambauers / github-2fa-nag.sh
Last active October 4, 2016 09:12
This script allows you to nag your organisation members to turn on two factor authentication (2FA) on GitHub.
#!/usr/bin/env bash
# 2FA Nag
# This script allows you to nag your organisation members to turn on two factor
# auth on GitHub. It grabs all organisation members, determines which have 2FA
# disabled and enabled, and assigns/deassigns them from a preset issue on a
# repository and adds comments once a week in order to nag them to do it. The
# script should be run once per day via a cron job.
@sambauers
sambauers / circleci-parallel.sh
Last active February 20, 2019 20:39
Splits tests across multiple Circle CI nodes manually.
#!/bin/bash
# Add this script to your code in the root directory, then add the following to your circle.yml
# test:
# override:
# - ./circleci-parallel.sh:
# parallel: true
while getopts ":hp:" opt; do
case $opt in