Skip to content

Instantly share code, notes, and snippets.

View benubois's full-sized avatar

Ben Ubois benubois

View GitHub Profile
@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
<?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>
<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>

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
class SendStats
include Sidekiq::Worker
sidekiq_options queue: :critical, retry: false
MEGABYTE = 1024.0 * 1024.0
def perform
memcached_stats
redis_stats
postgres_stats
@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)
#(Document:0x3fc9e955ba34 {
name = "document",
children = [
#(Element:0x3fc9e955b214 {
name = "feed",
namespace = #(Namespace:0x3fc9e955aeb8 {
href = "http://www.w3.org/2005/Atom"
}),
children = [
#(Text "\n "),
@benubois
benubois / tab_select.js
Last active December 12, 2015 06:08
Select nested jquery tabs within tabs. Using a query string like ?selected_tabs=tab-3,section-tab-2. The selected tabs should be the comma separated ids of the tabs that should be active.
tabSelect: function(args) {
var queryString = greenplum.queryString();
if (typeof(queryString.selected_tabs) == 'string') {
var selectedTabs = queryString.selected_tabs.split(',');
var parentTabs = '';
for (var i=0; i < selectedTabs.length; i++) {
var index = jQuery('[href~=#' + selectedTabs[i] + ']', parentTabs).parent('li').index();
var tabs = jQuery(jQuery('#' + selectedTabs[i], parentTabs).parents('.tabs')[0]);
tabs.tabs().tabs('select', index);
var parentTabs = jQuery('#' + selectedTabs[i], parentTabs);
@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"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>io.redis.redis-server</string>
<key>ProgramArguments</key>
<array>