Skip to content

Instantly share code, notes, and snippets.

View tralamazza's full-sized avatar

Daniel Tralamazza tralamazza

View GitHub Profile
@tralamazza
tralamazza / build_ocl.bat
Created June 20, 2011 21:04
nvidia opencl cl.exe command line
@echo off
if "%1" == "" goto error
if not "%opencl_dir%" == "" goto build
echo ############# Setting env vars #############
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
set opencl_dir=C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\OpenCL\common
:build
@tralamazza
tralamazza / gist:1102772
Created July 24, 2011 16:09
socketstream 0.1.8 npm install -g error
$ npm install socketstream -g
/usr/local/bin/socketstream -> /usr/local/lib/node_modules/socketstream/bin/socketstream
> zeromq@0.5.1 preinstall /usr/local/lib/node_modules/socketstream/node_modules/zeromq
> node-waf clean || true; node-waf configure build
Nothing to clean (project not configured)
Setting srcdir to : /usr/local/lib/node_modules/socketstream/node_modules/zeromq
Setting blddir to : /usr/local/lib/node_modules/socketstream/node_modules/zeromq/build
Checking for program g++ or c++ : /usr/bin/g++
@tralamazza
tralamazza / gist:1106179
Created July 26, 2011 07:17
dummy nc web server
{ echo -ne "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\n"; node -v; } | nc.traditional -l -p 8001
@tralamazza
tralamazza / rapleaf-proxy.js
Created July 26, 2011 15:37
(http - https) proxy rapleaf
var http = require('http'),
httpProxy = require('http-proxy');
var proxy = new httpProxy.HttpProxy();
proxy.on('proxyError', function(err, req, res) {
console.log('proxy.error: ' + err);
});
proxy.on('end', function(req, res) {
@tralamazza
tralamazza / bind_hack.js
Created July 31, 2011 23:28
node.js bind() hack
/*
* Author: Daniel Tralamazza <tralamazza@gmail.com>
*
* Patch Socket for a before connect event.
* Important! You must require this module before anything else.
*
* Usage:
*
* var patch = require('./bind_hack');
* var bind_f = process.binding('net').bind;
@tralamazza
tralamazza / breathalizer.cpp
Created August 15, 2011 08:43
breathalizer
/*
* breathalizer.cpp
*
* Created on: Aug 13, 2011
* Author: Daniel Tralamazza <daniel@tralamazza.com>
* URL: http://www.facebook.com/careers/puzzles.php?puzzle_id=17
*/
#define NORVIG
#define FACEBOOK
@tralamazza
tralamazza / gist:1345911
Created November 7, 2011 19:35
sbteclipse example gives cyclic reference error
$ sbt
[info] Loading global plugins from C:\Users\daniel.m.tralamazza\.sbt\plugins
[info] Loading project definition from C:\Users\daniel.m.tralamazza\Projects\sbt
eclipse\example\project
[info] Updating {file:/C:/Users/daniel.m.tralamazza/Projects/sbteclipse/example/
project/}default-6af6fc...
[info] Resolving default#default-ae3a02;0.0 ...
[info] Resolving org.scala-tools.sbt#sbt_2.9.1;0.11.1 ...
[info] Resolving org.scala-tools.sbt#main_2.9.1;0.11.1 ...
[info] Resolving org.scala-tools.sbt#actions_2.9.1;0.11.1 ...
@tralamazza
tralamazza / EnumHelper.cs
Created December 8, 2011 21:44
Enumerable "converter" (w/ lambda)
using System;
using System.Collections;
using System.Collections.Generic;
namespace EnumHelper
{
public class EnumeratorAdapter<T, K> : IEnumerator<K>
{
private IEnumerator<T> Enumerator = null;
UI frameworks
* https://github.com/appMobi/jQ.Mobi
* https://github.com/senchalabs/jQTouch
MVC frameworks
* https://github.com/documentcloud/backbone/
* http://spinejs.com/
* https://github.com/emberjs/ember.js
* https://github.com/SteveSanderson/knockout/
@tralamazza
tralamazza / gist:1828817
Created February 14, 2012 18:21
extract strings from m's and xib's
#!/bin/sh
find . -name *.xib | xargs ruby -ne '$_.match(/<string key="(.*)">(.*)<\/string>/){|m|puts "\"#{m[2]}\" = \"#{m[2]}\";" if m[1] =~ /IB.*Title/}'
find . -name *.m | xargs ruby -ne '$_.scan(/NSLocalizedString\s*\(\s*@"([^"]*)"\s*,[^)]*\)/){|m|puts "\"#{m[0]}\" = \"#{m[0]}\";"}'
find . -name *.m | xargs ruby -ne '$_.scan(/__\(\s*@"([^"]*)"\s*\)/){|m|puts "\"#{m[0]}\" = \"#{m[0]}\";"}'