Skip to content

Instantly share code, notes, and snippets.

View morxs's full-sized avatar

Rudy Suyanto morxs

View GitHub Profile
@morxs
morxs / terbilang.py
Created March 25, 2019 11:08
konversi angka ke terbilang
#-------------------------------------------------------------------------------
# Name: terbilang.py
# Purpose:
#
# Author: Rudy
#
# Created: 25/03/2019
# Copyright: (c) Rudy 2019
# Licence: <your licence>
#-------------------------------------------------------------------------------
@morxs
morxs / rank_2_month.sql
Created March 1, 2019 07:52
getting 2 last months using rank
SELECT *, RANK() OVER( ORDER BY "CALMONTH" DESC) AS "RankRank"
FROM
(
SELECT DISTINCT "YEAR", "MONTH", "CALMONTH"
FROM _SYS_BI.M_TIME_DIMENSION
WHERE "CALMONTH" IN
(
SELECT TOP 2 DISTINCT "CALMONTH"
FROM _SYS_BI.M_TIME_DIMENSION
WHERE "CALMONTH" < (
@morxs
morxs / json_format_unmarshal.go
Created November 8, 2018 10:00
Result json format is crucial on declaring variable in golang
package main
import (
"encoding/json"
"fmt"
"time"
)
type message struct {
Name string
@morxs
morxs / marshal_unmarshal_json.go
Created November 8, 2018 09:54
How titled case variable in struct can affect json.Marshal and json.Unmarshal
package main
import (
"encoding/json"
"fmt"
)
// not title case variable -- not work!
type person struct {
first string
@morxs
morxs / go-conv.go
Created December 22, 2017 04:20
Simple Go Implementation to convert TAB to SEMICOLON from a file
package main
import (
"flag"
"fmt"
"io/ioutil"
"strings"
)
func main() {
@morxs
morxs / remove_nonlatin_character.regex
Created November 17, 2015 10:30
Remove non-latin characters
[^a-zA-Z0-9\\\-\ \(\)\/\"\?\,\&\n]+
@morxs
morxs / trailing_space.regex
Created August 18, 2015 09:46
Select trailing space of each line
( )*$
@morxs
morxs / Vagrantfile
Created July 20, 2015 13:43
Vagrant sample for use on Windows along with docker
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@morxs
morxs / select_hana_memory_consumption.sql
Created June 29, 2015 02:31
HANA memory consumption
SELECT
TABLE_NAME,
MEMORY_SIZE_IN_TOTAL,
MEMORY_SIZE_IN_MAIN,
MEMORY_SIZE_IN_DELTA,
ESTIMATED_MAX_MEMORY_SIZE_IN_TOTAL,
RECORD_COUNT
FROM m_cs_tables
where schema_name = 'SCHEMA'
order by ESTIMATED_MAX_MEMORY_SIZE_IN_TOTAL desc
@morxs
morxs / hana_sql_reverse_search_table_using_package_model.sql
Last active August 29, 2015 14:23
HANA SQL to query table used from HANA package model
-- HANA query to Reverse search what table are being used in a HANA Package model
-- Usage: change DEPENDENT_OBJECT_NAME and BASE_SCHEMA_NAME parameter accordingly
SELECT distinct
BASE_OBJECT_NAME
FROM "SYS"."OBJECT_DEPENDENCIES"
where left(DEPENDENT_OBJECT_NAME, locate(DEPENDENT_OBJECT_NAME,'::') -1) in ('HANA-PACKAGE')
and BASE_SCHEMA_NAME = 'SCHEMA'
and DEPENDENT_SCHEMA_NAME = 'PUBLIC'