Skip to content

Instantly share code, notes, and snippets.

@neiltron
neiltron / stashboard.py
Created January 14, 2011 22:15
hack stashboard to make it update server status with cron
import urllib
import urllib2
import socket
from google.appengine.api import urlfetch
from google.appengine.api.urlfetch import DownloadError
from google.appengine.ext import db
from models import Status, Service, Event
from datetime import datetime, timedelta, date
@neiltron
neiltron / cron.yaml
Created January 14, 2011 22:25
cron.yaml to run stashboard.py periodically
cron:
- description: periodic server checks
url: /check
schedule: every 30 minutes
@neiltron
neiltron / app.yaml
Created January 14, 2011 22:26
necessary changes to app.yaml to make our stashboard cron work
- url: /check
script: stashboard.py
secure: optional
@neiltron
neiltron / app.rb
Created May 4, 2011 22:19
Sinatra/mongoid issues
#removed a bunch of routes that aren't relevant
require 'rubygems'
require 'bundler'
require 'sinatra'
require 'haml'
require 'bson'
require 'models/user'
def publish_activity!
activity = current_user.publish_activity(:send_karma, :object => karma, :target => receiver, :receivers => [receiver, current_user])
activity.organization = current_organization
activity.save
activity.notify!
activity
end
@neiltron
neiltron / proxy.js
Created April 3, 2012 19:00
Node HTTP proxy with url rewriting.
var util = require('util'),
colors = require('colors'),
http = require('http'),
httpProxy = require('http-proxy');
//
// Http Server with proxyRequest Handler and Latency
//
var proxy = new httpProxy.RoutingProxy();
http.createServer(function (req, res) {
movieDb.Router = Backbone.Router.extend({
routes:{
'': 'landPage',
'home': 'landPage',
'login': 'login',
'signup': 'signup',
'addmovie': 'addMovie'
},
landPage: function(p){

Keybase proof

I hereby claim:

  • I am neiltron on github.
  • I am neiltron (https://keybase.io/neiltron) on keybase.
  • I have a public key whose fingerprint is 5878 68AE 3F36 9B5B 636A 9D18 2327 637C EDDD FC57

To claim this, I am signing this object:

@neiltron
neiltron / gist:5f3bb1f1e4b8bbcb85c5fb09c1ad1e84
Last active September 6, 2017 13:22
Example of texture setup that doesn't work on iOS
let regl = new Regl({
canvas: canvas,
extensions: ['OES_texture_float', 'OES_texture_half_float'],
optionalExtensions: ['oes_texture_float_linear', 'OES_texture_half_float']
});
const RADIUS = dimensions.width > 800 ? 256 : 64;
const TEXTURE_DATA = (Array(RADIUS * RADIUS * 4)).fill(1).map((p, i) => {
angle = i / (RADIUS / 2);
@neiltron
neiltron / lines.js
Created January 19, 2018 15:49
Create basic, straight line meshes for webgl
const line = Array(40).fill([0, 0, 0]).map((el, index) => [.01 * (index % 2 ? 1 : -1), .2 * Math.floor(index / 2.0), 0]);
const cells = [];
for (let i = 0; i < 20; i += 2) {
cells.push(0 + i, 1 + i, 2 + i);
cells.push(1 + i, 2 + i, 3 + i);
}