Skip to content

Instantly share code, notes, and snippets.

@eidantoei
eidantoei / nagios_status_cgi.user.css
Created July 21, 2012 11:57
userstyles for nagios status.cgi
/* ---- Hide Objects ---- */
body>table:nth-child(1),
body.status>table>tbody td[width="30%"],
div.statusTitle,
div.statusSort,
td.filter,
div.itemTotalsTitle {
display:none;
}
@eidantoei
eidantoei / disable_temporary_hosts.sh
Created July 6, 2012 09:54
余計なhostsコメントアウトして帰るやつ
#!/bin/bash
BORDER="# -------- TEMPORARY_HOSTS --------"
L=$(( $(fgrep -n "${BORDER}" /etc/hosts | cut -d: -f1) + 1 ))
sudo sed -i.$(date +%F-%H-%M-%S) "${L},\$s/^\([^#]\)/#\1/g" /etc/hosts
cat /etc/hosts
@eidantoei
eidantoei / thunderbird-sound-control.sh
Created June 8, 2012 07:52
Quick mute Thunderbird notification sound (bash script)
#!/bin/bash
SND_ON="/Users/me/Music/win95.wav"
SND_OFF="/Users/me/Music/silent.wav"
SND_ALIAS="/Users/me/Music/thunderbird_notify.wav"
HASH_ON=$(md5 -q ${SND_ON})
HASH_OFF=$(md5 -q ${SND_OFF})
HASH_ALIAS=$(md5 -q ${SND_ALIAS})
@eidantoei
eidantoei / gist:2873634
Created June 5, 2012 08:28
Quick mute Thunderbird notification sound
alias thunderbird-sound-off='cp -p ~/Music/silent.wav ~/Music/thunderbird_notify.wav'
alias thunderbird-sound-on='cp -p ~/Music/win95.wav ~/Music/thunderbird_notify.wav'
@eidantoei
eidantoei / README
Created May 31, 2012 07:44
tailf+awk: Add timestamp
Shell 1
=======
# ./logger.sh
Shell 2
=======
# tailf log | awk -f add_timestamp.awk
@eidantoei
eidantoei / exmample.pde
Created April 6, 2012 19:20
generate animated gif from Proce55ing saveFrame()
void setup(){
// iroiro
}
void draw(){
// arekore
saveFrame("out-####.gif");
}
@eidantoei
eidantoei / example.com.js
Created January 29, 2012 18:05
Nagiosのサービス詳細ページで[A]キー押すとackにするページに連れてってくれるdotjs
pattern=/https:\/\/([^\/]+)\/(.+)\/extinfo.cgi\?type=2&host=([^&]+)&service=(.+)$/
$(".extinfo").keypress(function(event) {
if ( event.which == 97 ) {
url_from = location.href;
if ( url_from.match(pattern)){
url_to = url_from.replace(pattern,"https://$1/$2/cmd.cgi?cmd_typ=34&host=$3&service=$4");
location.href = url_to;
}
}
@eidantoei
eidantoei / c2g.rb
Created May 30, 2011 16:48
Visualizing `uniq -c` result
#!/usr/bin/env ruby
require 'optparse'
bar_string = "|"
bar_max = 30
max = 0
$es_s=["\033[34m","\033[36m","\033[32m","\033[33m","\033[35m","\033[31m"]
$es_b="\033[30m"
while :; do clear; uptime; echo; /usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /; if [ $? -eq 0 ]; then echo -e "\e[0;32m[OK]\e[0m"; elif [ $? -eq 1 ]; then echo -e "\e[0;33m[WARNING]\e[0m"; elif [ $? -eq 2 ]; then echo -e "\e[0;31m[CRITICAL]\e[0m"; fi; sleep 1; done
@eidantoei
eidantoei / itunesautocutting-20110116.scpt
Created January 15, 2011 15:23
iTunes auto cutting
tell application "iTunes"
play
repeat
next track
set l to duration of current track
repeat 16 times
set p to random number from (l - 1)
set r to random number from 1 to 4
set d to 2 ^ (4 - r) / 10
repeat 2 ^ r times