Skip to content

Instantly share code, notes, and snippets.

View chusri's full-sized avatar
🏠
Working from home

Thaweesak Chusri chusri

🏠
Working from home
  • Bangkok
View GitHub Profile
@chusri
chusri / MathCalc.kt
Created August 22, 2019 04:21 — forked from first087/MathCalc.kt
โจทย์เลข ป.4
fun calc() {
val ans = mutableListOf<Double>()
do {
val random8 = mutableListOf<Int>()
for (i in 1..8) {
random8.add(Random.nextInt(0, 9 + 1))
}
fun charToRandomNumber(ch: Char) = random8[ch.toByte() - 65]
fun transformDigit(digit: Int, ch: Char) = 10.0.pow(digit - 1) * charToRandomNumber(ch)
@chusri
chusri / git-deployment.md
Created July 22, 2019 07:34 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

# coding: utf-8
# FILE:
# -----
# /mnt/Vancouver/apps/Webcam-Face-Detect/webcam_cv3_v2_fps_v3.py
# FUNCTIONALITY:
# --------------
# * outputs webcam to screen and finds faces, eyes
# * writes webcam video to *.avi file (MJPG codec) via OpenCV/FourCC
apiVersion: batch/v1beta1
kind: CronJob
metadata:
annotations:
name: ecr-cred-helper
namespace: default
spec:
concurrencyPolicy: Allow
failedJobsHistoryLimit: 1
jobTemplate:
@chusri
chusri / folder_list.py
Last active May 23, 2019 07:13 — forked from korakot/folder_list.py
List all files under a publicly-shared folder in Google Drive (in Colab)
from google.colab import auth
auth.authenticate_user() # must authenticate
'''list all ids of files directly under folder folder_id'''
def folder_list(folder_id):
from googleapiclient.discovery import build
gdrive = build('drive', 'v3').files()
res = gdrive.list(q="'%s' in parents" % folder_id).execute()
return [f['id'] for f in res['files']]
@chusri
chusri / Makefile
Created May 16, 2019 05:53 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@chusri
chusri / install_nodejs_and_yarn_homebrew.md
Created May 4, 2019 15:24 — forked from nijicha/install_nodejs_and_yarn_homebrew.md
Install NVM, Node.js, Yarn via Homebrew

Install NVM, NodeJS, Yarn via Homebrew

Prerequisites

  • Homebrew should be installed (Command line tools for Xcode are included).

Getting start

Install NVM and NodeJS

  1. Install nvm via Homebrew
use myuserdb
db.createUser(
{
user: "myuser",
pwd: "mypassword",
roles: [ "dbOwner" ]
}
)
@chusri
chusri / .dron-nodejs.yml
Last active March 20, 2019 10:14
Drone IO configuration for nodejs
pipeline:
restore-cache:
image: drillster/drone-volume-cache
restore: true
mount:
- ./.yarn-cache
- ./node_modules
volumes:
- /tmp/cache:/cache
@chusri
chusri / cuda_installation_on_ubuntu_18.04
Created January 13, 2019 12:37 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
cuda 9.0 complete installation procedure for ubuntu 18.04 LTS
#!/bin/bash
## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.2 in ubuntu 18.04
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###