Skip to content

Instantly share code, notes, and snippets.

View yu-iskw's full-sized avatar

Yu Ishikawa yu-iskw

View GitHub Profile
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active July 4, 2024 07:31
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@ueshin
ueshin / sparkmeetup.md
Created September 8, 2014 08:49
Spark SQL samples for Spark Meetup
@erikerlandson
erikerlandson / distance.scala
Created August 21, 2014 22:51
Suggestion for simple distance metric (and measure) design
import breeze.linalg.{Vector => BV, DenseVector => DBV}
import org.apache.spark.annotation.Experimental
import org.apache.spark.mllib.linalg.{Vector, DenseVector}
trait DistanceMeasure extends Function2[BV[Double], BV[Double], Double] with Serializable {
// each measure/metric defines for itself:
override def apply(v1: BV[Double], v2: BV[Double]): Double
// a catch-all overloading of "()" for spark vectors
// can also be overridden on a per-class basis, if it is advantageous
@sebsto
sebsto / gist:19b99f1fa1f32cae5d00
Created August 8, 2014 15:53
Install Maven with Yum on Amazon Linux
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
@freeman-lab
freeman-lab / bisecting.scala
Last active December 29, 2015 07:45
Bisecting k-means for hierarchical clustering in Spark
/**
* bisecting <master> <input> <nNodes> <subIterations>
*
* divisive hierarchical clustering using bisecting k-means
* assumes input is a text file, each row is a data point
* given as numbers separated by spaces
*
*/
import org.apache.spark.SparkContext
@mushkevych
mushkevych / Dockerfile
Last active December 30, 2015 07:39
Docker CDH 4.5
FROM ubuntu:precise
MAINTAINER Bohdan Mushkevych
# Installing Oracle JDK
RUN apt-get -y install python-software-properties ;\
add-apt-repository ppa:webupd8team/java ;\
apt-get update && apt-get -y upgrade ;\
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections ;\
apt-get -y install oracle-java7-installer && apt-get clean ;\
update-alternatives --display java ;\
@jiahao
jiahao / BagOfLittleBootstraps.jl
Last active March 23, 2021 02:22
Julia implementation of the Bag of Little Bootstraps (BLB) method (documented as, e.g., Algorithm 1 in arXiv:1112.5016)
using Distributions
export Measure, DiscreteMeasure, Estimator, EstimatorQuality,
blb, randsubset
abstract Measure
type DiscreteMeasure{S<:Number,T<:Number} <: Measure
points :: Vector{S}
weights :: Vector{T}
@jirutka
jirutka / analytics.conf
Created March 31, 2013 01:03
Add Google Analytics tracking code to HTML via nginx
#
# Add Google Analytics tracking code to HTML response
#
# Usage:
# set $tracking_id 'UA-12345678-9';
# include incl/analytics.conf;
#
# It needs nginx compiled with option --with-http_sub_module.
# Uses optimized GA code from: http://mathiasbynens.be/notes/async-analytics-snippet
#
import numpy as np
from scipy import linalg
from sklearn.utils import array2d, as_float_array
from sklearn.base import TransformerMixin, BaseEstimator
class ZCA(BaseEstimator, TransformerMixin):
def __init__(self, regularization=10**-5, copy=False):
self.regularization = regularization
@ndarville
ndarville / business-models.md
Last active October 23, 2024 17:18
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google