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
benubois / setup.sh
Created Apr 17, 2018
ruby cgi server setup
View setup.sh
#!/bin/bash
set -e
# Set your gems, username and password
gems="bundler"
username="username"
password="password"
apt update -y
View rss2.xml
<?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>
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='https://feedbin.com?subscribe='+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 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
View send_stats.rb
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 Jul 30, 2013
This requires that `ifstat`, `sysstat` and `bc` are installed and that `$LIBRATO_USER` and `$LIBRATO_TOKEN` are available in the environment.
View send_system_stats.sh
#!/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)
View nokogiri_results.rb
#(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 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
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"
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"
View gist:2998578
<?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>
You can’t perform that action at this time.