Skip to content

Instantly share code, notes, and snippets.

View dahoba's full-sized avatar

Siritas S dahoba

View GitHub Profile
@dahoba
dahoba / postgres-cheatsheet.md
Created August 9, 2017 03:31 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@dahoba
dahoba / install-thai-fonts-google.sh
Last active August 22, 2019 06:59
Shellscript to download Google 13+1 Thai Fonts and install into OS
#!/bin/bash
# Google 13+1 Thai Fonts by Cadson Demak
# The script inspired by [Web-Font-Load](https://github.com/qrpike/Web-Font-Load)
# OS detection
osdetect=$(uname)
file_path="unknown"
if [[ "$osdetect" == 'Darwin' ]]; then

Keybase proof

I hereby claim:

  • I am dahoba on github.
  • I am siritas (https://keybase.io/siritas) on keybase.
  • I have a public key ASDe7ntTvPimQ3saUBtfF3IRD-M190wNaVmRdFPEH3HfEAo

To claim this, I am signing this object:

@dahoba
dahoba / parse_generic_json_array.go
Last active March 22, 2019 10:58
Golang iterate/parse generic JSON array
// https://play.golang.org/p/ZC2RkvU5XtN
package main
import "fmt"
import "encoding/json"
func main() {
payload := []byte(`[{"Key":"[email protected]:PROGRESS_UPDATE:UPD-000001", "Record":{"contractId":"UPD-000001","type":3,"status":0,"createDate":"2019-03-15T12:07:48+07:00","content":"mock content","groupOfSignatures":[{"participantId":"[email protected]","signature":"alice's signature"},{"participantId":"[email protected]","signature":""}],"message":"progress update for Inv 01","generalReferences":["n/a"],"pendingBy":"","referenceToContractId":""}},{"Key":"[email protected]:PROGRESS_UPDATE:UPD-000010", "Record":{"contractId":"UPD-000010","type":3,"status":4,"createDate":"2019-03-15T12:07:48+07:00","content":"mock content","groupOfSignatures":[{"participantId":"[email protected]","signature":"alice's signature"},{"participantId":"[email protected]","signature":""}],"message":"progress update for Inv 01","generalReferences":["n/a"],"pendingBy":"","referenceToContractId":""}},{"Key":"[email protected]:PROGRESS_UPDATE:UPD-00
@dahoba
dahoba / ikbc-td108-manual.txt
Created July 5, 2019 03:08
IKBC TD108 Manual
# ⌨️ TD 108 Functions Description
***Light Mode:***
PRESS FN + F4
+ Light up
+ Wave
+ Rain drop
+ Aurora
+ Breathing
@dahoba
dahoba / thai-id-card.go
Last active August 15, 2019 07:42 — forked from bouroo/thai-id-card.go
Thai National ID Card reader in GO
package main
// Require pcscd, libpcsclite
import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"os"
"strconv"
@dahoba
dahoba / Dockerfile_springboot
Last active August 22, 2019 07:16
Dockerfile Spring boot with maven,tomcat,Sarabun font template
FROM maven:3-jdk-8-slim as builder
ENV JAVA_OPTS=""
ENV MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
WORKDIR /server
COPY pom.xml .
RUN mvn -B -fn verify
@dahoba
dahoba / Dockerfile_angular
Last active August 22, 2019 07:16
Dockerfile for nodejs compile angular then serve with nginx (alpine linux)
FROM node:10-alpine as builder
WORKDIR /front
COPY package*.json /front/
RUN npm i \
&& mkdir /ng-app \
&& mv ./node_modules /ng-app/
WORKDIR /ng-app
COPY . .
@dahoba
dahoba / Dockerfile_postgres
Created August 22, 2019 07:16
Dockerfile for Postgres bundle with initial database structure
FROM postgres:11-alpine
# default database name
ENV DATABASE_DATABASE dev-db
# default username
ENV DATABASE_USERNAME postgres
# default password
ENV DATABASE_PASSWORD dev.db2019
@dahoba
dahoba / ssh-port-forward.sample.txt
Last active August 11, 2021 09:47
Port forward commands
**Note** the jump-server should config to use ssh passwordless
Connect to internal oracle db via jump-server
```
ssh -v -N -L 1521:internal-oracle-db:1521 jump-server
```
```
ssh -v -N -L 15432:localhost:5432 postgres-server