Skip to content

Instantly share code, notes, and snippets.

@sean-kang
sean-kang / README.md
Last active December 29, 2015 22:58 — forked from toddq/README.md

Description

Dashing widget to display weather from forecast.io. This widget was forked from https://gist.github.com/toddq/5422352.

##Usage

To use this widget, copy forecast.coffee, forecast.html, and forecast.scss into the /widgets/forecast directory. Put the forecast.rb file in your /jobs folder.

Get skycons.js from and put it in your assets/javascripts directory.

@sean-kang
sean-kang / gist:ca3b553f5c682a383f74
Last active August 29, 2015 14:27
jq search example
aws route53 list-hosted-zones | jq '.HostedZones[] | select(.Name=="hello.world.")'
@sean-kang
sean-kang / gist:3a4845899742d4fb1e7c
Created May 15, 2015 03:34
Lita wrapper to make it managed by monit
1. service wrapper to generate PID
#!/usr/bin/env bash
PIDFILE=/home/lita/lita/tmp/lita.pid
case $1 in
start)
cd /home/lita/lita ;
echo $$ > ${PIDFILE} ;
exec bundle exec lita start >> /home/lita/lita/log/lita.log 2>&1 ;;
@sean-kang
sean-kang / gist:d1b34d0e3df57d152435
Created May 1, 2015 01:27
Outgoing spam alert cron script
#!/usr/bin/env bash
HOURLY_THRESHOLD=200
total=$(cat /var/log/mail.log | sma -q -d -D 00,59 2>&1 | grep Total | head -1 | awk '{print $4}')
[ -z $total ] && total=0
if [ $total -gt $HOURLY_THRESHOLD ]; then
hostname=$(hostname -f)
@sean-kang
sean-kang / gist:9edf74dc5ec27508e435
Created April 13, 2015 04:24
Domain redirection example
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.hello.nz$ [NC]
RewriteRule ^(.*)$ http://hello.nz$1 [L,R=301]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^hello.co.nz$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.hello.co.nz$ [NC]
RewriteRule ^(.*)$ http://hello.nz$1 [L,R=301]
tar --exclude=httpdocs/media/catalog/product/cache --exclude=httpdocs/var/cache --exclude=httpdocs/var/session --exclude=httpdocs/var/tmp --exclude=httpdocs/var/log --exclude=httpdocs/var/backups -cvzf backup.tar.gz httpdocs
@sean-kang
sean-kang / gist:10014749
Last active August 29, 2015 13:58
Chef role for apache welcome page
{
"name": "apache2",
"description": "Apache Web Server",
"json_class": "Chef::Role",
"default_attributes": {
"apache":{"listen_ports":["80","443"],"default_site_enabled":true}
},
"override_attributes": {
},
"chef_type": "role",
@sean-kang
sean-kang / gist:9043615
Created February 17, 2014 02:18
Java Heap Dump with jmap
sudo -u <process owner> jmap -dump:file='/tmp/some-dump-name.bin' <process ID>
@sean-kang
sean-kang / gist:9013380
Last active November 27, 2017 03:53
.tmux.conf
set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
set-window-option -g mode-keys vi
set -g default-terminal "screen-256color"
@sean-kang
sean-kang / gist:8797673
Last active August 29, 2015 13:56
How to gracefully change haproxy configuration on runtime
Below is an example.
To remove a node from backend.
socat readline /var/run/haproxy.stat
disable server <backend_node>/<hostname>