Skip to content

Instantly share code, notes, and snippets.

View ivan-loh's full-sized avatar
🌴
On vacation

Ivan Loh ivan-loh

🌴
On vacation
  • ERIAD SOLUTION PLT
  • Malaysia
View GitHub Profile
@ivan-loh
ivan-loh / crud.js
Created August 24, 2015 18:45
elasticsearch 1.7.1 sample nodejs crud
'use strict';
var async = require('async');
var elastic = require('./app/helpers/elasticsearch.js');
async.waterfall([
// create
function (done) {
elastic.index({
@ivan-loh
ivan-loh / Main.go
Last active August 8, 2019 06:44
Sample Bigquery Streaming
package main
import (
"cloud.google.com/go/bigquery"
"context"
"google.golang.org/api/googleapi"
"log"
"time"
)
@ivan-loh
ivan-loh / Job.go
Created December 14, 2018 03:35
golang google bigquery check for job error
package main
import (
"cloud.google.com/go/bigquery"
"context"
"log"
)
func main () {
@ivan-loh
ivan-loh / Gitlab CI.md
Created February 20, 2017 19:59
Basic continuous deployment flow with GitLab Community Edition 8.16.6
@ivan-loh
ivan-loh / memory.sh
Created December 16, 2017 08:36
script to use to monitor memory utilization
#!/bin/bash
function alert {
curl --header 'Access-Token: <access_token_here>' \
--header 'Content-Type: application/json' \
--data-binary '{"body":"Memory Threshold Reachd","title":"Database Server Alert","type":"note"}' \
--request POST \
https://api.pushbullet.com/v2/pushes
}
@ivan-loh
ivan-loh / node-app-server.sh
Last active April 2, 2017 04:43
simple setup script to create a node app server
#!/bin/bash
# - Nginx
# - NodeJS
# - Redis
# - Mongodb
# - Mosh
# Add Required repository
sudo add-apt-repository -y ppa:keithw/mosh
@ivan-loh
ivan-loh / rxjs_operators_by_example.md
Created March 21, 2017 16:24 — forked from btroncone/rxjs_operators_by_example.md
RxJS 5 Operators By Example
@ivan-loh
ivan-loh / zeppelin-bq.MD
Created March 10, 2017 06:12
how to get zepplin's bq interpreter to play nice with bq

too lazy to explain the steps but it goes something like this

  1. "install" gcloud sdk
  2. gcloud init
  3. bq command setup
  4. setup application default login gcloud auth application-default login --no-launch-browser
@ivan-loh
ivan-loh / rename.sh
Created December 12, 2016 20:06
bash script to mass rename files in a directory
#!/bin/sh
SRCEXT="html"
DSTEXT="txt"
for file in *.$SRCEXT; do
echo "$file -> `basename "$file" .$SRCEXT`.$DSTEXT"
mv "$file" "`basename "$file" .$SRCEXT`.$DSTEXT"
done
@ivan-loh
ivan-loh / read-csv.go
Created December 25, 2016 15:53
reading some csv file
package main
import (
"bufio"
"encoding/csv"
"fmt"
"io"
"log"
"os"
)