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 | |
WD="$HOME/.dropbox-dist/dropbox-lnx*/images/hicolor/16x16/status" | |
BGCOLOR=`ruby -e "puts File.read(ENV['HOME'] + '/.i3/config').gsub(/^.*bar\s\{.*colors\s\{.*background\s(#[0-9a-f]{6}).*$/m, '\1')"` | |
cd $WD | |
mkdir backup | |
cp ./*.png backup/ | |
for i in ./*.png; do | |
echo -n "Adding background ($BGCOLOR) to $i ... " |
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
class ShutdownHandler | |
{ | |
private $catch; | |
private $error; | |
public function __construct($catch = null) | |
{ | |
$this->catch = $catch ?: E_ERROR | E_PARSE; | |
} |
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 | |
# Put this in $HOME/bin/get_git_branch.sh | |
if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then | |
if [[ "$branch" == "HEAD" ]]; then | |
branch='detached*' | |
fi | |
fi |
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 | |
files=$(git status --porcelain | sed -e 's/^.* //' | grep -P '\.php$') | |
for f in $files; do | |
php -l $f | |
done |
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 | |
## | |
# ByteScramble | |
# | |
# Copyright 2015 Anders K. Madsen <[email protected]> | |
# Licence: MIT <https://opensource.org/licenses/MIT> | |
# | |
# Description: | |
# ------------ |
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
# Hack to run every 2nd Tuesday: | |
# - Cron notation to run every Tuesday | |
# - PHP exits with (effectively): date("W") % 2 | |
# - Hacked to remove all '%' because cron can't handle them | |
# - Use shell chaining (&& and ||) to determine even/odd weeks | |
# - && for even week numbers, || for odd | |
# So to run `echo "Still here ..."` every other Tuesday at 10:30 AM: | |
30 10 * * 2 php -r 'exit((int)fmod(date("W"),2));' && echo "Still here ..." | |
# Note: PHP can obviously be replaced with anything that |
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 [[ "${1}x" == "x" ]]; then | |
USE_PIPE=false | |
else | |
USE_PIPE=true | |
PIPE=${1} | |
fi | |
FORMAT="%s.%2N" |
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/ruby | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'csv' | |
if ARGV.length < 1 | |
puts "Error: Please supply a URL pointing to an Apache Extended Server Status page" | |
exit |
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 is executed whenever conditions are met | |
# Change this to whatever you would like to have happen | |
alert() { | |
echo 'ALERT, ALERT!!!' | |
printf "Average hit interval: %.2f sec.\n" "$AVG" | |
printf "Threshold: %d sec.\n" "$THRESHOLD" | |
printf "Window length: %d\n" "$WINDOW_LENGTH" | |
printf "Last window: %s\n" "${INTERVALS[*]}" |
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/ruby | |
require 'webrick/https' | |
require 'openssl' | |
require 'optparse' | |
# Defaults | |
cfg = { | |
port: 8443, | |
root: "." |
OlderNewer