Skip to content

Instantly share code, notes, and snippets.

Ben Ubois benubois

Block or report user

Report or block benubois

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
benubois /
Created Apr 17, 2018
ruby cgi server setup
set -e
# Set your gems, username and password
apt update -y
View rss2.xml
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="" xmlns:wfw="" xmlns:dc="" xmlns:atom="" xmlns:sy="" xmlns:slash="" >
<lastBuildDate>Thu, 12 Jan 2017 07:59:25 +0000</lastBuildDate>
View bookmarklet.html
<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=''+a.href);}}};if(!g){window.alert('No Feed Found');};">Subscribe In Feedbin</a>
View gist:6122707

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
* About to connect() to port 80 (#0)
*   Trying
* connected
* Connected to ( 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
View send_stats.rb
class SendStats
include Sidekiq::Worker
sidekiq_options queue: :critical, retry: false
MEGABYTE = 1024.0 * 1024.0
def perform
benubois /
Created Jul 30, 2013
This requires that `ifstat`, `sysstat` and `bc` are installed and that `$LIBRATO_USER` and `$LIBRATO_TOKEN` are available in the environment.
# 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)
View nokogiri_results.rb
#(Document:0x3fc9e955ba34 {
name = "document",
children = [
#(Element:0x3fc9e955b214 {
name = "feed",
namespace = #(Namespace:0x3fc9e955aeb8 {
href = ""
children = [
#(Text "\n "),
benubois / tab_select.js
Last active Dec 12, 2015
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.
View tab_select.js
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 / pow
Created Sep 13, 2012
Enable and disable the pow firewall rule for Cisco AnyConnect
View pow
#!/usr/bin/env bash
# Set up the environment.
set -e
POW_ROOT="$HOME/Library/Application Support/Pow"
View gist:2998578
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
You can’t perform that action at this time.