This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# force a reload of the config file | |
unbind r | |
bind r source-file ~/.tmux.conf | |
set -g history-limit 5000 | |
set -g default-terminal "screen-256color" | |
set -g status-left-length 24 | |
# remap prefix from 'C-b' to 'C-a' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMP FUNCTION | |
cleanup(text | |
STRING | |
) | |
RETURNS | |
STRUCT < | |
key string, | |
value string> | |
LANGUAGE js AS """ | |
return JSON.parse(text); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install ucu4c via Brew | |
brew install icu4c | |
# Create relative symlinks for icu4c | |
brew link --force icu4c | |
# Install pyicu via pip | |
# Make sure ICU_VERSION matches the one you just installed | |
sudo ICU_VERSION=60.2 pip install pyicu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
mydate AS( | |
SELECT | |
day | |
FROM | |
UNNEST( GENERATE_DATE_ARRAY( DATE_TRUNC(DATE_SUB(CURRENT_DATE,INTERVAL 1 YEAR),MONTH), CURRENT_DATE(), INTERVAL 1 DAY) ) AS day ), | |
randomdata AS( | |
SELECT | |
t1.*, | |
ROUND(t1.revenue*rand()) AS user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#standard sql | |
SELECT "Current Month" as type,cast(TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), MONTH) as date) | |
UNION ALL | |
SELECT "Week ending",DATE_ADD(cast(TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), WEEK) as date),interval 7 DAY) | |
UNION ALL | |
SELECT "Current Month",DATE_TRUNC(CURRENT_DATE,MONTH) | |
UNION ALL | |
SELECT "First day of last Month",DATE_TRUNC(DATE_SUB(CURRENT_DATE,INTERVAL 1 MONTH),MONTH) | |
UNION ALL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#standard sql | |
#https://stackoverflow.com/questions/38929121/duplicating-records-to-fill-gap-between-dates-in-google-bigquery | |
SELECT day | |
FROM UNNEST( | |
GENERATE_DATE_ARRAY( | |
DATE_TRUNC(DATE_SUB(CURRENT_DATE,INTERVAL 1 YEAR),MONTH) | |
, CURRENT_DATE(), INTERVAL 1 DAY) | |
) AS day |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#BiDirectional LSTM | |
#Training Data | |
# Embedding1,Embedding2,Labels | |
# 1 Jurong,Jurng,1 | |
# 2 Jurong,Jrung,1 | |
# 3 Jurong,Bishan,0 | |
# Purpose: To create measure to determine how similar sequences of inputs are to each other. | |
import os | |
import random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
import tensorflow.contrib.eager as tfe | |
tfe.enable_eager_execution() | |
from tensorflow.examples.tutorials.mnist import input_data | |
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) | |
# Training Parameters | |
learning_rate = 0.001 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOAD CSV FROM ‘https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat' AS line | |
CREATE (:Airport { myid:toInt(line[0]),name: line[1], lat: line[6],lon: line[7]}) | |
CREATE INDEX ON :Airport(myid) | |
LOAD CSV FROM ‘https://raw.githubusercontent.com/jpatokal/openflights/master/data/routes.dat' AS line | |
MATCH (from:Airport {myid: toInt(line[3])}) | |
MATCH (to:Airport {myid: toInt(line[5])}) | |
MERGE (from)-[r:route]->(to) | |
ON MATCH SET r.count = r.count + 1 ON CREATE SET r.count = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggmap) | |
airports <- read.csv(“https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat", header = FALSE) | |
names(airports) <- c(“id”, “name”, “city”, “country”, “code”, | |
“icao”, “lat”, “lon”, “altitude”, “timezone”, | |
“dst”,”tz”) | |
location <- c( 115,0 ) | |
location | |
map <- get_map(location, zoom=3,maptype=’toner-lite’) | |
p <- ggmap(map) | |
p |