Skip to content

Instantly share code, notes, and snippets.

View jbenner-radham's full-sized avatar

James Benner jbenner-radham

View GitHub Profile
import sublime, sublime_plugin
from pprint import pprint
class ExampleCommand(sublime_plugin.TextCommand):
def run(self, edit):
#print(vars(self.view.window()))
# This gets all the text on the page, but it seems a bit excessive...
reg = sublime.Region(0, self.view.size())
print(self.view.substr(reg))
@jbenner-radham
jbenner-radham / pricing-ec2-vs-digitalocean.md
Last active December 5, 2018 18:31
Pricing comparison for Amazon AWS EC2 vs. Digital Ocean

Amazon EC2 and DigitalOcean Comparison

              | EC2 Small (previous gen) | Digital Ocean 2GB

-----------------|--------------------------|------------------ Hourly Price | $0.044 | $0.03 Monthy Price | $32 | $20 RAM | 1.7GB | 2GB HDD | 160GB | 40GB (SDD) CPU | x1 | x2 Monthy Transfer | 1GB | 3TB

@jbenner-radham
jbenner-radham / ubuntu-php-phalcon-setup.md
Last active August 29, 2015 13:57
Cheatsheet for setting up Apache & PHP w/Phalcon on Ubuntu

Apache & PHP Install On Ubuntu (13.10)

PHP & Apache

sudo apt-get install apache2 php5 php5-apcu php5-json
sudo a2enmod rewrite
sudo service apache2 reload
@jbenner-radham
jbenner-radham / noobquest_v2.cpp
Created April 2, 2014 17:36
Random C++ I was playing around with because I'm a noob.
/* g++ -std=c++0x -Wall [-static] <source> [-o <binary>] */
/* Now with awesome proper constructors and destructors. */
#include <iostream>
using namespace std;
class Hero
{
public:
@jbenner-radham
jbenner-radham / negotiate-test.c
Last active August 29, 2015 13:58
Prototyping an HTTP content negotiation function for super magic fun time!
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
/**
* @link https://developer.mozilla.org/en-US/docs/HTTP/Content_negotiation
*/
@jbenner-radham
jbenner-radham / curl_json_test.cpp
Created April 9, 2014 14:26
Curling some JSON for fun!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CURL_STATICLIB
#include <curl/curl.h>
#include "picojson.h"
using namespace std;
@jbenner-radham
jbenner-radham / generic-selector-c11-test.c
Created April 18, 2014 00:40
C11 Generic Selector Test
#include <stdio.h>
int main()
{
const char *str = "hello, world";
char cc = 'c';
printf("%s\n", _Generic(cc, char: "c", int: "i"));
}
@jbenner-radham
jbenner-radham / gulp-handlebars.js
Created September 8, 2014 04:02
Handlebars render to HTML task for Gulp.js, with a little bit of the Harp metadata context spec implemented. (using ES6 arrow functions and string templates)
'use strict';
var $ = require('gulp-load-plugins')();
var _ = require('lodash');
var fs = require('node-fs-extra');
var gulp = require('gulp');
var handlebars = require('handlebars');
var path = require('path');
gulp.task('handlebars', () => {
@jbenner-radham
jbenner-radham / rfc1123_date.c
Created September 10, 2014 15:42
Generate an RFC1123 compliant date/time stamp.
/*@-skipposixheaders@*/
#include <sys/_types/_time_t.h>
/*@=skipposixheaders@*/
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/**
@jbenner-radham
jbenner-radham / libsafec-test.c
Last active August 29, 2015 14:07
Experimenting with libsafec for C11 safe string function goodness.
#include <stdio.h> /* printf(), fprintf() */
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h> /* atoi() */
#include <string.h> /* memset(), strlen() */
#include <unistd.h> /* close() */
#include "safe_lib.h"
/**