Skip to content

Instantly share code, notes, and snippets.

@robdodson
robdodson / gist:bab25f5286d0ebc13c48
Last active June 9, 2017 14:12
polymer gravatar
<polymer-element name="user-gravatar" attributes="email">
<template>
<img src="https://secure.gravatar.com/avatar/{{gid}}" />
</template>
<script>
Polymer('user-gravatar', {
ready: function() {
this.gid = md5(this.email);
}
});
package spark.examples
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.json4s.jackson.JsonMethods
import org.json4s.jackson.JsonMethods._
import org.json4s.JsonAST._
object HDFSDeleteExample {
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.json4s.jackson.JsonMethods
import org.json4s.jackson.JsonMethods._
import org.json4s.JsonAST._
import org.json4s.DefaultFormats
object CandyCrushExample {
def main(args: Array[String]): Unit = {
@arngarden
arngarden / ann.py
Created March 24, 2014 19:28
Pylearn2 example with termination criteria, momentum and learning rate adjustor
import theano
from pylearn2.models import mlp
from pylearn2.train_extensions import best_params
from pylearn2.training_algorithms import sgd, learning_rule
from pylearn2.utils import serial
from pylearn2.termination_criteria import MonitorBased
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from sklearn.preprocessing import StandardScaler
import numpy as np
from random import randint
@diramazioni
diramazioni / texture_change.py
Created February 27, 2014 17:54
blender python: texture change from command line
'''
texture image path are relative to the blend file directory. run from command line like this:
texture=img/2012720989_c.jpg blender -b mug.blend --python texture_change.py -F PNG -s 1 -e 1 -j 1 -t 0 -a
''''
import os
image_file = os.getenv('texture')
if not image_file:
image_file="img/2012720989_c.jpg"
@kespindler
kespindler / setup.sh
Created February 9, 2014 01:00
Benchmark EC2 GPU instances with Pylearn2 deep learning on MNIST dataset
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y install git make python-dev python-setuptools libblas-dev gfortran g++ python-pip python-numpy python-scipy liblapack-dev
sudo pip install ipython nose
sudo apt-get install screen
sudo pip install --upgrade git+git://github.com/Theano/Theano.git
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_5.5-0_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1204_5.5-0_amd64.deb
sudo apt-get update
@voluntas
voluntas / mqtt.rst
Last active February 16, 2018 00:03
MQTT コトハジメ

MQTT コトハジメ

更新:2014-05-14
バージョン:0.0.12
作者:@voluntas
URL:http://voluntas.github.io/

とても詳しいまとめがありますので、ますはそちらを見ることをオススメします。

@bhollis
bhollis / checkerboard.js.coffee
Created November 28, 2013 02:31
Three.js snippet for creating a checkerboard plane. Good for use as a floor in demos.
# Build a checkerboard colored square plane with "segments" number of tiles per side.
# Using three.js v62
checkerboard = (segments=8) ->
geometry = new THREE.PlaneGeometry(100, 100, segments, segments)
materialEven = new THREE.MeshBasicMaterial(color: 0xccccfc)
materialOdd = new THREE.MeshBasicMaterial(color: 0x444464)
materials = [materialEven, materialOdd]
for x in [0...segments]
for y in [0...segments]
@sssa2000
sssa2000 / 20131007_2.md
Last active October 24, 2016 16:00
20131007_2

我记得我曾经有两次写博客提及过度量这个词: 一篇是2010年的博文:http://www.sssa2000.com/?p=33。 另一篇是2012年的博文:http://www.sssa2000.com/?p=748。 当时的我基本上是把可度量和可测试画上了等号。

随着自己慢慢开始关注管理,对可度量这个词的含义有了更多的认识。例如:当需要回答某些问题的时候,我发现过去的眼光太局限:

  • 团队生产的产品质量有多高?
  • 团队的效率够高吗?
  • 团队的能力有多强?
@robertcasanova
robertcasanova / polygon.js
Created September 17, 2013 12:40
Create custom 2d polygon with THREE.js
////////////////////////////////////////////////////////////////////////////////
// Polygon Creation Exercise
// Your task is to complete the function PolygonGeometry(sides)
// which takes 1 argument:
// sides - how many edges the polygon has.
// Return the mesh that defines the minimum number of triangles necessary
// to draw the polygon.
// Radius of the polygon is 1. Center of the polygon is at 0, 0.
////////////////////////////////////////////////////////////////////////////////
/*global, THREE, Coordinates, $, document, window*/