Skip to content

Instantly share code, notes, and snippets.

View jmatt's full-sized avatar

JMatt Peterson jmatt

View GitHub Profile
@jmatt
jmatt / map.js
Created April 4, 2012 20:54
Part of map.js that adds and filters markers on the map.
// Removes all markers on the map.
function clearOverlays(category) {
if (markersArray) {
for (i in markersArray) {
if (category === undefined) {
markersArray[i].setMap(null);
}
else {
if (markersArray[i].val.Category.Name == category) {
markersArray[i].setMap(null);
@jmatt
jmatt / gist:2403063
Created April 17, 2012 02:50
Hmmm no idea why this works and other combinations of popen don't.
#!/usr/bin/ruby
require 'net/http'
require 'net/https'
require 'openssl'
require 'rubygems'
require 'json'
require 'cgi'
require 'yaml'
@jmatt
jmatt / fizzbuzz.c
Created May 5, 2012 20:43
fizzbuzz in under 140 characters
#define F(f,r) printf("%s",i%f?"":#r"zz")
int main(int i){for(--i;i++^100;puts(""))F(3,Fi)|F(5,Bu)||printf("%i",i);}
@jmatt
jmatt / logger.py
Created August 1, 2012 23:16
Logging for Atmosphere
"""
Logging for atmosphere.
Provides two separate log levels. One for dependencies and one for the application.
django's settings.py:
## logging imports
import logging
import atmosphere.logger
@jmatt
jmatt / partial_openstack_driver.py
Created September 7, 2012 01:56
OpenStack_1_1_NodeDriver extended to improve IP handling and add suspend and resume.
def _to_node(self, api_node):
"""
Extends OpenStack_1_1_NodeDriver._to_node adding support for public and private ips.
"""
def _set_ips(self):
"""
Set up ips in the api_node so _to_node may call it's super.
"""
try:
api_node['addresses']['public'] = []
@jmatt
jmatt / cc-client-marshal-adb.c
Created September 20, 2012 00:55
Scary embedded key in eucalyptus
/*
Copyright (c) 2009 Eucalyptus Systems, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, only version 3 of the License.
This file is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
@jmatt
jmatt / .tmux.conf
Created May 10, 2013 05:02
tmux configuration.
#Resize on every detach (Useful on multiple sessions)
set-window-option -g aggressive-resize on
# Set the base index for windows to 1 instead of 0
set -g base-index 1
# # Set the base index for panes to 1 instead of 0
setw -g pane-base-index 1
# Set status bar
@jmatt
jmatt / gist:7593051
Created November 22, 2013 01:16
os_quota_sets work
In [19]: driver._connection.ex_get_quota()
Out[19]:
{'quota_set': {'cores': 32,
'fixed_ips': -1,
'floating_ips': 10,
'id': 'ed13d984a1b04d4583ffced305cec00d',
'injected_file_content_bytes': 10240,
'injected_file_path_bytes': 255,
'injected_files': 5,
'instances': 10,
@jmatt
jmatt / New ex_list_all_volumes
Last active August 29, 2015 14:00
Decorators could simplify using different services and endpoints.
from decorators import cinder
# ...
@cinder
def ex_list_all_volumes(self):
"""
List all volumes from all tenants of a user
"""
resp = self.connection.request(

Keybase proof

I hereby claim:

  • I am jmatt on github.
  • I am jmatt (https://keybase.io/jmatt) on keybase.
  • I have a public key whose fingerprint is 80C7 F160 C28F 59D5 F240 2277 958D CC8E 61E3 CB1B

To claim this, I am signing this object: