Skip to content

Instantly share code, notes, and snippets.

View boris317's full-sized avatar

Shawn Adams boris317

View GitHub Profile
@boris317
boris317 / statsd-tcpdump.sh
Last active November 14, 2017 16:43
Verify data is being fed to collectd and statsd
# statsd
sudo tcpdump -i eth0 -p -n -s 1500 -A udp port 8125
# statsd flushing to graphite
sudo tcpdump 'port 2005 or 2009' -s0 -A
# collectd
sudo tcpdump -i eth0 -p -n -s 1500 -A udp port 25827
@dgmltn
dgmltn / speedtest
Created October 29, 2014 20:58
Speed test shell script (using curl or wget)
#!/bin/sh
FILE_URL=http://speedtest.wdc01.softlayer.com/downloads/test10.zip
if [ -e /usr/bin/curl ] && [ -e /usr/bin/bc ] && [ -e /usr/bin/xargs ]; then
echo "scale=2; `curl --progress-bar -w "%{speed_download}" $FILE_URL -o /dev/null` / 131072"\
| bc\
| xargs -I {} echo {} mbps
elif [ -e /usr/bin/curl ]; then
curl -o /dev/null $FILE_URL
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@clarkdave
clarkdave / logstash-sentry.rb
Last active May 15, 2023 11:34
(Logstash) Sentry output plugin
# The MIT License (MIT)
# Copyright (c) 2014 Dave Clark
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@jaygooby
jaygooby / percona-xtrabackup.sh
Last active May 9, 2022 15:43
Call via crontab on whatever schedule suits you; keep n full mysql Percona xtrabackups of your mysql database, with binary logs applied. Also does a full mysqldump that can then have the binary logs applied to restore to a point-in-time backup via the binlogs. Copy all of this (backup, mysqldump, binlogs) to S3.
#!/bin/bash
#
# Carries out a full mysqldump, calls percona-xtrabackup and then
# copies the sql dump, the percona backup and your mysql bin logs
# to S3 using s3cmd http://s3tools.org/s3cmd
#
# TODO: extract out the S3 backup stuff to make it optional, and so
# other s3 programs can replace the s3cmd call.
# TODO: the if [ $? == 0 ] alert blocks should be a function
# TODO: make the if [ $? == 0 ] if [ $? != 0 ] more consistent - test
@dansimau
dansimau / README.md
Created July 13, 2012 10:39
Enable git-style colour output in regular diff on Mac OS X

Enable git-style colour output in regular diff

Mac OS X

  1. Install colordiff using Homebrew:

     brew install colordiff
    
  2. Add function to your ~/.bash_profile:

@jch
jch / rack_boot.rb
Created April 30, 2012 05:16
Programmatically start a rack app
require 'rack'
class RackApp
def self.call(env)
[200, {'Content-Type' => 'text/html'}, ['derp']]
end
end
# For a full list of options, see
# http://www.ruby-doc.org/stdlib-1.9.3/libdoc/webrick/rdoc/WEBrick.html
@mattetti
mattetti / rack_example.ru
Created December 8, 2011 13:58
Very basic rack application showing how to use a router based on the uri and how to process requests based on the HTTP method used.
#########################################
# Very basic rack application showing how to use a router based on the uri
# and how to process requests based on the HTTP method used.
#
# Usage:
# $ rackup rack_example.ru
#
# $ curl -X POST -d 'title=retire&body=I should retire in a nice island' localhost:9292/ideas
# $ curl -X POST -d 'title=ask Satish for a gift&body=Find a way to get Satish to send me a gift' localhost:9292/ideas
# $ curl localhost:9292/ideas
@mayoff
mayoff / gist:1138816
Last active December 8, 2023 22:00
AppleScript to make Google Chrome open/reload a URL
(* To the extent possible under law, Rob Mayoff has waived all copyright and related or neighboring rights to “AppleScript to make Google Chrome open/reload a URL”. This work is published from: United States. https://creativecommons.org/publicdomain/zero/1.0/ *)
tell application "Google Chrome"
activate
set theUrl to "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
if (count every window) = 0 then
make new window
end if
set found to false