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 / Stopwatch.java
Last active April 26, 2017 16:51
To calculate time runner when run the code
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* timer/stopwatch object that for measure elapsed time running in java.
* <p>
* Contains
* <ol>
* <li>parse timer api: {@link #MStoS(long)} or {@link #NStoS(long)}</li>
* <li>Error message: {@link #getError()} or {@link #getErrors()}</li>
@kamontat
kamontat / Checker.java
Last active March 6, 2017 17:23
Check Number in TextField
/**
* The checker to check string can or can't change to number.
*
* @author kamontat
* @version 1.0
* @since Mon 06/Mar/2017 - 7:39 PM
*/
public class Checker {
/**
* check input string must contains digit and <b>dot</b> ONLY.
@kamontat
kamontat / JarExtract.java
Created November 18, 2016 17:47
for extract jar file into normal system file
package code.test;
import java.io.*;
import java.nio.file.Paths;
import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
/**
* To Extract jar file into normal file (System file)
@kamontat
kamontat / index.html
Last active November 25, 2016 11:17
Young Webmaster Camp(YWC) Homework(HW)
<!DOCTYPE html>
<html lang='en'>
<head>
<!-- Latest compiled and minified CSS -->
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' integrity='sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u' crossorigin='anonymous'>
<!-- Optional theme -->
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css' integrity='sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp' crossorigin='anonymous'>
<!-- jquery of google CDN -->
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
@kamontat
kamontat / DimensionUtilities.java
Last active March 7, 2017 04:25
deal with display location
package com.view.gui.lib;
import java.awt.*;
/**
* utilities with dimension and screen display.
*
* @author kamontat
* @version 1.3
* @since 1/30/2017 AD - 1:47 PM
@kamontat
kamontat / New iTerm2 Tab at Finder
Last active October 8, 2020 11:38
The AppleScript service, For open the new tab (if window exist) or new window (if window not launch before)
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
on CD_to(theDir)
set go_dir to "cd " & theDir & " && clear"
-- check running name in `activity Monitor` this must matching.
set isRunning to is_running("iTerm2")
#!/bin/bash
# go to current directory
cd "$(dirname "$0")"
@kamontat
kamontat / README.md
Last active April 2, 2020 14:03
COLOR CONSTANTS (BASH)

Develop

  1. clone this project by git clone https://gist.github.com/717f75e6b87606940017adf385274044.git color
  2. run cd color
  3. write the code as what you want
    • color_constants.sh - new version of constant (using tput)
    • color_raw_constants.sh - old version of constant (using raw text to assign)
      • some terminal app, might miss the color.
    • install.sh - install color script

Run

@kamontat
kamontat / base64.bash
Last active May 12, 2017 11:33
encode and decode str with base64
#!/bin/bash
INPUT=false
ACTION=""
CODE=""
while getopts 'iD:E:h' flag; do
case "${flag}" in
i) INPUT=true ;;
D) ACTION="D" && CODE="$OPTARG" ;;
#!/bin/bash
# make sure that you give permission to this file
# run chmod 755 atom-plugin.sh
# or chmod +x atom-plugin.sh
# -----------------------------------------
# command setting
if ! command -v apm >/dev/null 2>&1 && ! command -v apm-beta >/dev/null 2>&1; then
echo "you don't have commandline interface, install it!"