Skip to content

Instantly share code, notes, and snippets.

View gnap's full-sized avatar

George Ang gnap

  • zhihu.com
  • Beijing
View GitHub Profile
@yaroslavvb
yaroslavvb / local_distributed_benchmark.py
Last active September 16, 2021 10:26
Benchmark distributed tensorflow locally by adding vector of ones on worker2 to variable on worker1 as fast as possible
"""Benchmark tensorflow distributed by adding vector of ones on worker2
to variable on worker1 as fast as possible.
On 2014 macbook, TensorFlow 0.10 this shows
Local rate: 2175.28 MB per second
Distributed rate: 107.13 MB per second
"""
@rasteron
rasteron / Distortion.glsl
Created September 1, 2015 23:59
Underwater Distortion
#include "Uniforms.glsl"
#include "Samplers.glsl"
#include "Transform.glsl"
#include "ScreenPos.glsl"
#include "Lighting.glsl"
varying vec2 vScreenPos;
uniform sampler2D tex;
uniform float total_time = 10.0;
@jehiah
jehiah / lru_cache.c
Created April 3, 2011 21:35
a LRU cache in C using uthash
#include <string.h>
#include <uthash.h>
// this is an example of how to do a LRU cache in C using uthash
// http://uthash.sourceforge.net/
// by Jehiah Czebotar 2011 - jehiah@gmail.com
// this code is in the public domain http://unlicense.org/
#define MAX_CACHE_SIZE 100000
@rjungemann
rjungemann / udp-thing.js
Created June 19, 2010 07:43 — forked from pquerna/udp-thing.js
UDP client and server in Node.js
log = require('sys').log
dgram = require('./lib/dgram')
var Buffer = require('buffer').Buffer;
var endat = 10;
var count = 0;
socket = dgram.createSocket();
socket.addListener('message', function (msg, rinfo) {
log('got message from '+ rinfo.address +' port: '+ rinfo.port);
log('data len: '+ rinfo.size + " data: "+ msg.toString('ascii', 0, rinfo.size));