Skip to content

Instantly share code, notes, and snippets.

View secunit64's full-sized avatar

Madhu Srinivasan secunit64

View GitHub Profile
@secunit64
secunit64 / fp textures
Created August 1, 2013 07:39
Creating floating point textures in threejs. Taken from here: https://github.com/mrdoob/three.js/issues/386
function createTextureFromData ( width, height, data ) {
if (!gl.getExtension("OES_texture_float")) {
throw("Requires OES_texture_float extension");
}
texture = new THREE.Texture( );
texture.needsUpdate = false;
texture.__webglTexture = gl.createTexture();
gl.bindTexture( gl.TEXTURE_2D, texture.__webglTexture );
@secunit64
secunit64 / foo.rs
Created December 31, 2013 11:52 — forked from anonymous/foo.rs
#[no_uv];
extern mod native;
#[start]
fn start(argc: int, argv: **u8) -> int {
do native::start(argc, argv) {
main();
}
}
@secunit64
secunit64 / green.rs
Created December 31, 2013 11:52 — forked from anonymous/green.rs
#[no_uv];
extern mod green;
extern mod rustuv; // pull in I/O support
#[start]
fn start(argc: int, argv: **u8) -> int {
do green::start(argc, argv) {
main();
}
}
@secunit64
secunit64 / pool.rs
Created December 31, 2013 11:52 — forked from anonymous/pool.rs
#[no_uv];
extern mod native;
extern mod green;
extern mod rustuv; // pull in I/O support for libgreen
use std::task::TaskOpts;
#[start]
fn start(argc: int, argv: **u8) -> int {
do native::start(argc, argv) {
static N:int = 100000;
//
// Chinese Whispers in Rust
// Based on example by Rob Pike
// in http://www.youtube.com/watch?v=f6kdp27TYZs
//
fn main() {
let (leftmost_port, leftmost_chan) = Chan::new();
let mut leftc: Chan<int> = leftmost_chan;
@secunit64
secunit64 / 0_reuse_code.js
Created May 31, 2014 18:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/*
* drivertest.cpp
* Vector addition (host code)
*
* Andrei de A. Formiga, 2012-06-04
*/
#include <stdio.h>
#include <stdlib.h>
@secunit64
secunit64 / git.migrate
Created January 25, 2016 07:33 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/srinivm/OSX/software/gpuarray/0.2/ ../
@secunit64
secunit64 / center_geo.py
Created April 25, 2017 12:11 — forked from amites/center_geo.py
Center Geolocations
from math import cos, sin, atan2, sqrt
def center_geolocation(geolocations):
"""
Provide a relatively accurate center lat, lon returned as a list pair, given
a list of list pairs.
ex: in: geolocations = ((lat1,lon1), (lat2,lon2),)
out: (center_lat, center_lon)
"""
x = 0