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
def valid?(ip) | |
rgx=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ | |
ip.match(rgx) != nil | |
end |
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 bash | |
areyousure() { | |
read -p "${1}" bool | |
[ "${bool}" != "y" ] && echo "aborting..." && exit 0 | |
} | |
# usage | |
areyousure "This file already exists. Overwrite? (y/N) " | |
echo "yep - was sure" |
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 bash | |
# Convert an arbitrary date in the format of "YYY-MM-DD HH:MM" from | |
# local time to UTC. | |
date -u --date=@$(date "+%s" --date="2021-02-28 03:06") |
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
# Adding a user only if the don't exist | |
useradd_if_not_exists() { | |
id -u ${1} >/dev/null 2>&1 || useradd --system ${1} | |
} |
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 | |
# usage: | |
# - wrapper.sh do-list ls -la | |
# - wrapper.sh import-job /usr/local/bin/import param1 param2 | |
TIMESTAMP=$(date +%s) | |
MONITOR_NAME=$1 | |
shift 1 | |
COMMAND=$@ |
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
### Keybase proof | |
I hereby claim: | |
* I am thefury on github. | |
* I am trevoroke (https://keybase.io/trevoroke) on keybase. | |
* I have a public key ASA76kBMXta-la5TG7qVAHHfa6uQ4JdVCccxB5FHxJ2WfQo | |
To claim this, I am signing this object: |
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
git log --pretty=format: --name-only | sort | uniq -c | sort -rg | head -10 |
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 | |
# grabbed from somehwere else on the net. Can't remember where. | |
SESSION_NAME="my-project-name" | |
cd ~/golang/src/github.com/thefury/my-project-name | |
tmux has-session -t $SESSION_NAME |
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
function pomodoro { | |
case $1 in | |
start ) | |
echo 'terminal-notifier -title "🍅 Pomodoro Done" -message "Starting short break…"' | at + 25 minutes &> /dev/null | |
;; | |
break ) | |
echo 'terminal-notifier -title "⌛ Short Break Done" -message "Start your next Pomodoro."' | at + 5 minutes &> /dev/null | |
;; | |
esac |
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 | |
require 'optparse' | |
require 'ostruct' | |
require 'filesize' | |
require 'pry' | |
opts = {} | |
opts[:path] = '/' | |
opts[:number] = 15 |
NewerOlder