Skip to content

Instantly share code, notes, and snippets.

Marina One East Tower #05-01

  • limited hot-desking (~16) + few general tables
  • 2 phone booths (more like small meeting rooms but only has a chair and small side table)
  • few phone covers
  • clean & big toilet with showers 🚿

Need to register on the reception for access card to take the lift.

OCBC Centre East #15-01

@gary-liguoliang
gary-liguoliang / slugify.py
Last active May 23, 2020 16:20
slugify strings with pure regex and python
import re
def slugify(s: str) -> str:
s_after_basic_replacement = re.sub("[^a-zA-Z0-9]", "-", s)
s_with_no_continues_dash = re.sub("[-]+", "-", s_after_basic_replacement)
s_with_no_ending_dash = re.sub("-$", "", s_with_no_continues_dash)
return s_with_no_ending_dash
version=$(cd ${DIR}/../functions && grep -m1 version package.json | awk -F: '{ print $2 }' | sed 's/[", ]//g')
if expected != actual:
import json
with open("expected.json", "w+") as e:
e.write(json.dumps(expected, indent=4, sort_keys=True))
with open("actual.json", "w+") as a:
a.write(json.dumps(actual, indent=4, sort_keys=True))
with open('pretty.json', "w+") as a:
a.write(json.dumps(data, indent=4, sort_keys=True))
  • install homebrew

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    source: https://brew.sh/

  • install iterm2

    brew cask install iterm2
    
import org.apache.poi.ss.usermodel.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class ReadExcel {
public static void main(String[] args) throws IOException {
@gary-liguoliang
gary-liguoliang / gist:1c12645fe8150a49950224d780dc4acf
Created October 23, 2018 14:03
How to automate setting Chrome as default browser in Windows 10
https://superuser.com/questions/1069346/how-to-automate-setting-chrome-as-default-browser-in-windows-10
@gary-liguoliang
gary-liguoliang / oracle-select-from-EAV-entity–attribute–value.md
Last active February 10, 2018 07:41
oracle-select-from-EAV-entity–attribute–value

test data:

CREATE TABLE ORDERS (
  order_id         NUMBER,
  attribute_name   VARCHAR2(32),
  text_value       VARCHAR2(32),
  number_value     NUMBER
);

INSERT INTO ORDERS VALUES (1, 'Currency', 'USD', NULL);
@gary-liguoliang
gary-liguoliang / spark-load-and-join-csv-files.java
Created January 24, 2018 11:56
Spark load and join CSV files
package com.test;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;
import java.util.List;
import java.util.regex.Pattern;