Skip to content

Instantly share code, notes, and snippets.

View glongman's full-sized avatar

Geoff Longman glongman

View GitHub Profile
@glongman
glongman / gist:72884af5edebdfe5bec1
Last active September 21, 2015 13:37
Broadcast ssh login to Production into Slack
  1. create a slack webhook integration - copy the webhook url
  2. add following to top of ~/.ssh/config
Host *
  PermitLocalCommand yes
  1. add LocalCommand to host entry
Host production.example.com
 User ubuntu
@glongman
glongman / gfx2gf
Last active August 29, 2015 14:06
Bash Version of Game Frame script
#!/usr/bin/env bash
# gfx2gf.bat v1.5 (20140823)
# by Jeremy Williams
#
# This batch file converts graphics for Game Frame compatibility (www.ledseq.com).
# *** You must have ImageMagick installed for it to run (www.imagemagick.org) ***
# Passed graphic files will be stretched, resized, & resampled if larger than 16x16. If
# the file is an animated GIF, a filmstrip graphic will be generated along with
# a CONFIG.INI using a "hold" value (framerate) equal to the first frame of the
# animation. Usually this works well, but you may still need to adjust the hold
@glongman
glongman / gist:2295280
Created April 3, 2012 20:27
My unsubmitted carrierwave-mongoid issue

Environment:

MacOSX 10.6.8 Ruby 1.9.3-p125 MongoDB

db version v2.0.3, pdfile version 4.5
Tue Apr  3 14:47:32 git version: 05bb8aa793660af8fce7e36b510ad48c27439697

Rails 3.2.1

@glongman
glongman / bootstrap.rb
Created March 3, 2012 20:02 — forked from jamiepenney/bootstrap.rb
Form builder for Twitter Bootstrap v2 form elements [Fork]
# This file goes in config/initializers
require 'bootstrap_form_builder'
# Make this the default Form Builder. You can delete this if you don't want form_for to use
# the bootstrap form builder by default
ActionView::Base.default_form_builder = BootstrapFormBuilder::FormBuilder
# Add in our FormHelper methods, so you can use bootstrap_form_for.
ActionView::Base.send :include, BootstrapFormBuilder::FormHelper
require 'test/unit'
class LuhnTest < Test::Unit::TestCase
def luhn_valid?(s)
return false unless s && s.is_a?(String)
return false if s.empty?
value = s.gsub(/\D/, '')
return false if value.empty?
value.
require.paths.unshift(__dirname + '/lib');
require.paths.unshift(__dirname);
require.paths.unshift(__dirname + '/deps/express/lib')
var sys = require('sys'),
fs = require('fs'),
mongo = require('deps/node-mongodb-native/lib/mongodb'),
svc = require('service_json'),
weekly = require('weekly');
diff --git a/monitor.js b/monitor.js
index 6f6d4ec..bc89c96 100644
--- a/monitor.js
+++ b/monitor.js
@@ -19,9 +19,11 @@ db.open(function(p_db) {
app.configure(function(){
app.set('root', __dirname);
app.set('db', db);
- app.use(express.staticProvider(__dirname + "public"));
- app.use(express.cookieDecoder);
http://www2.webkit.org/perf/sunspider-0.9/sunspider.html
TEST COMPARISON FROM TO DETAILS
=============================================================================
** TOTAL **: 1.11x as fast 391.4ms +/- 5.7% 353.0ms +/- 3.8% significant
=============================================================================
@glongman
glongman / unreal.html
Created May 4, 2010 04:03
HTML5 web socket bot for Unreal3 Bots. Includes HTML bot impl and ruby proxy server
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
<script>
// Note: the Bot implementation is called MYBOT and is defined after UT3BOT.
/* UT3BOT is a Utility that handles initiating the connection to the Unreal server
* via a web socket.
* To begin, you call
#import <Foundation/Foundation.h>
/*
* call:
* PrintPathInfo();
*
* params:
* None.
*
* returns:
* nothing (void?)