Skip to content

Instantly share code, notes, and snippets.

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@andrequeiroz
andrequeiroz / holtwinters.py
Last active July 5, 2023 07:50
Implementation of Holt-Winters algorithms in Python 2
#The MIT License (MIT)
#
#Copyright (c) 2015 Andre Queiroz
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#!/bin/bash
SOURCEINSTANCE=${SOURCEINSTANCE:-''}
SOURCEUSER=${SOURCEUSER:-'admin'}
SOURCEPORT=${SOURCEPORT:-'5439'}
SOURCEDB=${SOURCEDB:-'db'}
SOURCESCHEMA=${SOURCESCHEMA:-'public'}
SCHEMA=${SCHEMA:-'public'}
echo "CREATE TABLE ${SCHEMA}.${TABLE} ("
psql -h ${SOURCEINSTANCE} -U ${SOURCEUSER} -p ${SOURCEPORT} ${SOURCEDB} -t -c "select (\"column\" || ' ' || type || ' ENCODE ' || encoding || ',' ) from pg_table_def where schemaname='$SCHEMA' and tablename = '$TABLE'" | sed 's/ENCODE none/ENCODE RAW/' | sed '$d' | sed '$ s/,$//'
echo ")"

Presto connector development 1

One of the very good design decisions Presto designers made is that it's loosely coupled from storages.

Presto is a distributed SQL executor engine, and doesn't manager schema or metadata of tables by itself. It doesn't manage read data from storage by itself. Those businesses are done by plugins called Connector. Presto comes with Hive connector built-in, which connects Hive's metastore and HDFS to Presto.

We can connect any storages into Presto by writing connector plugins.

Plugin Architecture

@voluntas
voluntas / shiguredo.rst
Last active June 6, 2024 02:04
時雨堂コトハジメ
@frsyuki
frsyuki / presto-client.py
Last active October 11, 2020 09:56
Presto client for Ruby and Python
import os
import json
import httplib
import time
VERSION = "0.1.0"
class ClientSession:
def __init__(self, server, user, source=None, catalog=None, schema=None, debug=False):
self.server = server
sudo yum install jdk-7u65-linux-x64.rpm
sudo yum install gcc
sudo yum install gcc-gfortran
sudo yum install blas lapack arpack
unzip netlib-java-1.1.2.zip
cd ~/netlib-java-1.1.2
sed -i "s/1.2-SNAPSHOT/1.1.2/g" `grep -rl 1.2-SNAPSHOT .`
mvn install
cd native_system/
@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
@komiya-atsushi
komiya-atsushi / Base64Demo.java
Created August 31, 2014 17:51
Java 8 より導入された java.util.Base64 の利用デモ。
import java.io.PrintStream;
import java.util.Base64;
/**
* Java 8 より導入された java.util.Base64 の利用デモ。
*/
public class Base64Demo {
private static final PrintStream o = System.out;
public static void main(String[] args) {