Skip to content

Instantly share code, notes, and snippets.

View benubois's full-sized avatar

Ben Ubois benubois

View GitHub Profile
class SendStats
include Sidekiq::Worker
sidekiq_options queue: :critical, retry: false
MEGABYTE = 1024.0 * 1024.0
def perform
memcached_stats
redis_stats
postgres_stats

Original request says the Last-Modified date is Mon, 11 Nov 2013 14:16:00 GMT which is in the future so it is probably misconfigured.

curl -v http://www.pvponline.com/feed
* About to connect() to www.pvponline.com port 80 (#0)
*   Trying 54.245.239.139...
* connected
* Connected to www.pvponline.com (54.245.239.139) port 80 (#0)
> GET /feed HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5
@benubois
benubois / send_system_stats.sh
Created July 30, 2013 17:58
This requires that `ifstat`, `sysstat` and `bc` are installed and that `$LIBRATO_USER` and `$LIBRATO_TOKEN` are available in the environment.
#!/bin/bash
hostname=$(hostname)
# Run top twice, first output is cached
top_out=$(top -bn2 -d0.1)
cpu=$(echo "${top_out}" | grep "Cpu(s)" | sed -E "s/.*,\s*([0-9\.]+)\%id.*/\1/" | awk '{print 100 - $1}' | sed -n 2p)
memory_total=$(echo "${top_out}" | grep "Mem:" | awk {'print $2'} | sed s/k// | sed -n 2p)
@benubois
benubois / setup.sh
Created April 17, 2018 01:27
ruby cgi server setup
#!/bin/bash
set -e
# Set your gems, username and password
gems="bundler"
username="username"
password="password"
apt update -y
@benubois
benubois / pow
Created September 13, 2012 22:53
Enable and disable the pow firewall rule for Cisco AnyConnect
#!/usr/bin/env bash
# Set up the environment.
set -e
POW_ROOT="$HOME/Library/Application Support/Pow"
POW_CURRENT_PATH="$POW_ROOT/Current"
POW_VERSIONS_PATH="$POW_ROOT/Versions"
POWD_PLIST_PATH="$HOME/Library/LaunchAgents/cx.pow.powd.plist"
FIREWALL_PLIST_PATH="/Library/LaunchDaemons/cx.pow.firewall.plist"
<a href="javascript:void(d=document);void(el=d.getElementsByTagName('link'));void(g=false);for(i=0;i<el.length;i++){if(el[i].getAttribute('rel').indexOf('alternate')!=-1){ty=el[i].getAttribute('type');if(ty.indexOf('application/rss+xml')!=-1||ty.indexOf('text/xml')!=-1||ty.indexOf('application/atom+xml')!=-1){g=true;h=el[i].getAttribute('href');a=document.createElement('a');a.href=h;void(location.href='https://feedbin.com?subscribe='+a.href);}}};if(!g){window.alert('No Feed Found');};">Subscribe In Feedbin</a>
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" >
<channel>
<title>Title</title>
<link>https://example</link>
<description>description</description>
<lastBuildDate>Thu, 12 Jan 2017 07:59:25 +0000</lastBuildDate>
<language>en-US</language>
<sy:updatePeriod>hourly</sy:updatePeriod>