Skip to content

Instantly share code, notes, and snippets.

View kamontat's full-sized avatar
💭
I may be slow to respond.

Kamontat Chantrachirathumrong kamontat

💭
I may be slow to respond.
View GitHub Profile
@kamontat
kamontat / random.sh
Created October 2, 2018 04:26
random group for Prof. Somnuk subject in Kasetsart University
#!/usr/bin/env bash
# shellcheck disable=SC1000
# generate by v3.0.2
# link (https://github.com/Template-generator/script-genrating/tree/v3.0.2)
# set -x #DEBUG - Display commands and their arguments as they are executed.
# set -v #VERBOSE - Display shell input lines as they are read.
# set -n #EVALUATE - Check syntax of the script but don't execute.
@kamontat
kamontat / cloudSettings
Last active March 27, 2021 03:29
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-03-27T03:29:43.069Z","extensionVersion":"v3.4.3"}
#!/usr/bin/env bash
# shellcheck disable=SC1000
# generate by v3.0.2
# link (https://github.com/Template-generator/script-genrating/tree/v3.0.2)
# set -x #DEBUG - Display commands and their arguments as they are executed.
# set -v #VERBOSE - Display shell input lines as they are read.
# set -n #EVALUATE - Check syntax of the script but don't execute.
#!/usr/bin/env bash
# shellcheck disable=SC1000
# generate by v3.0.2
# link (https://github.com/Template-generator/script-genrating/tree/v3.0.2)
# set -x #DEBUG - Display commands and their arguments as they are executed.
# set -v #VERBOSE - Display shell input lines as they are read.
# set -n #EVALUATE - Check syntax of the script but don't execute.
@kamontat
kamontat / setup.bash
Created August 30, 2018 17:03
Restart Setup, To recreate Admin user in MacOS
# Shutdown your computer (Mac)
# Press `Command+S` and turn computer on.
# Press, until computer open black screen
## Type below to the screen
# Mount root dir
/sbin/mount -uw /
# remove setup entry
rm /var/db/.applesetupdone
#!/bin/bash
# <bitbar.title>command shortcut</bitbar.title>
# <bitbar.version>v1.1</bitbar.version>
# <bitbar.since>9 Mar 2018</bitbar.since>
# <bitbar.author>kamontat</bitbar.author>
# <bitbar.author.github>kamontat</bitbar.author.github>
# <bitbar.desc>Show setting shortcut keys</bitbar.desc>
# <bitbar.dependencies>bash</bitbar.dependencies>
function v5(h) {
var percent = Math.ceil(Math.random() * 100)
switch (h) {
case "g":
if (percent > 65)
return 5 // 35%
else if (percent > 40)
return 4 // 25%
else if (percent > 20)
return 3 // 20%

Useful-git-command

$ git rev-parse HEAD # git latest commit 
3386d270952e7d8dc614839bfb00de3529d56c77

$ git rev-parse --verify HEAD # git latest commit 
3386d270952e7d8dc614839bfb00de3529d56c77

$ git show-ref # turn references (branches and tags) into SHA-1
@kamontat
kamontat / sep.sh
Last active April 28, 2018 11:08
separate images raw files and jpg files
#!/usr/bin/env bash
# set -x #DEBUG - Display commands and their arguments as they are executed.
# set -v #VERBOSE - Display shell input lines as they are read.
# set -n #EVALUATE - Check syntax of the script but don't execute.
# -------------------------------------------------
# Create by: Kamontat Chantrachirathumrong
# -------------------------------------------------
# Version: 0.0.1 -- finish
@kamontat
kamontat / SearchRange.java
Created November 15, 2017 06:46
java code, searching (range) in input array
import java.util.*;
public class SearchRange {
public static void main(String[] agrs) {
Scanner input = new Scanner(System.in);
System.out.print("Enter n: ");
int n = Integer.parseInt(input.nextLine());
String[] textNums = input.nextLine().split(" ");
int[] numbers = new int[textNums.length];