Skip to content

Instantly share code, notes, and snippets.

@alperkokmen
alperkokmen / pd-event.sh
Last active April 6, 2024 20:39
Simple script to trigger, acknowledge, and resolve incidents via PagerDuty Integration API.
#!/bin/bash
CONTENT_TYPE="application/json"
DESCRIPTION="bad things™ are happening"
URL="https://events.pagerduty.com/generic/2010-04-15/create_event.json"
if [ $# -ne 3 ]; then
echo "Usage: pd-event.sh [TYPE] [SERVICE KEY] [INCIDENT KEY]"
echo " - TYPE: [t]rigger | [a]cknowledge | [r]esolve"
echo " - SERVICE KEY: unique identifier for service"
@alperkokmen
alperkokmen / search-logs.sh
Created October 4, 2013 22:30
simple log grepper that executes grep command on one or more hosts over ssh.
#!/bin/sh
##
# Set the variables below and then execute as follows:
#
# e.g. Search log files for foo@bar.com string.
# $ search-logs "foo@bar.com"
#
# e.g. Search log files for foo@bar.com and display surrounding 3 lines in addition to the matched line.
# $ search-logs "foo@bar.com" "-A 3 -B 3"
@alperkokmen
alperkokmen / twitter_oauth_helper.rb
Created December 4, 2012 06:39
Twitter OAuth Helper
# handy ruby script which allows developers to get oauth token/secret
# for a twitter application identified by consumer_key and consumer_secret.
require 'oauth'
print "consumer_key: "
consumer_key = STDIN.gets.strip
print "consumer_secret: "
consumer_secret = STDIN.gets.strip