Skip to content

Instantly share code, notes, and snippets.

View RobGThai's full-sized avatar
🎯
Focusing

Poohdish Rattanavijai RobGThai

🎯
Focusing
  • Bangkok, Thailand
View GitHub Profile
@RobGThai
RobGThai / init.vim
Created November 5, 2021 12:36
nvim
call plug#begin()
" Plug 'tpope/vim-sensible'
" Plug 'roxma/nvim-completion-manager'
" Plug 'SirVer/ultisnips'
" Plug 'honza/vim-snippets'
" Plug 'preservim/nerdtree'
" Plug 'unblevable/quick-scope'
" Plug 'vimoxide/vim-mkdir'
" Plug 'vimoxide/vim-indent-object'
" Plug 'vimwiki/vimwiki'
@RobGThai
RobGThai / fibonacci.py
Last active October 23, 2021 15:04
Fibonacci implementations.
class Solution:
def fib(self, n: int) -> int:
# 0 1 2 3 4 5 6
# 0 1 1 2 3 5 8
#return self.fib_r(n)
return self.fib_a(n)
def fib_a(self, n:int) -> int:
# Time Complexity: O(n)
# Space Complexity: O(1)
@RobGThai
RobGThai / merge_k.py
Created October 21, 2021 14:57
Merging K sorted list using divide and conquer technique.
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeKLists(self, lists: List[Optional[ListNode]]) -> Optional[ListNode]:
if not lists:
return None
@RobGThai
RobGThai / removeN.py
Created October 21, 2021 11:46
LinkedList solution.
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]:
if not head.next:
# Single node input meaning n = 1
Powered
power failed -> Red On
Green*
tick -> Yellow
Yellow
tick -> Red
Red
tick -> Green
Unpowered
Apr 11 22:46:10 tdc-ops-swf-02 account-server: ERROR __call__ error with PUT /sde/3306/AUTH_abcdefghi12345/PRD_20170411_M : LockTimeout (3s) /srv/node/sde/accounts/3306/ae2/cead29b1808e23f8c1668c5abe1f8ae2/.lock (txn: txf5dc7a70c023432caf6c3-0058ecfa3f)
@RobGThai
RobGThai / range.json
Created August 28, 2016 18:04
Example of how to query range with Elasticsearch.
{
"query": {
"bool": {
"must": [
{"range": {
"salary": {
"gte": 20000,
"lte": 60000
}
}}
@RobGThai
RobGThai / setup.sh
Last active April 19, 2016 09:51 — forked from n3tr/setup.sh
Install Spark + Zeppelin on EC2
# scala install
wget www.scala-lang.org/files/archive/scala-2.11.7.deb
sudo dpkg -i scala-2.11.7.deb
# sbt installation
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install sbt
@RobGThai
RobGThai / startup.py
Created January 19, 2016 17:04
For Codehew 2016, question 2 Start Up.
import json
def get_key(id):
return 'e' + str(id)
def create_r_graph(f):
emp_id_pos = 0
total_sub_pos = 1
subs_pos = 2
teams = {}
@RobGThai
RobGThai / NamedAsyncTask.java
Last active August 29, 2015 14:19
Abstract class for helping with naming AsyncTask in Android.
package common.asynctask;
import android.os.AsyncTask;
public abstract class NamedAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
private String oldName;
private void setNewThreadName(String name) {
oldName = Thread.currentThread().getName();
if(!TextUtils.isEmpty(name)) Thread.currentThread().setName(name);