Skip to content

Instantly share code, notes, and snippets.

View namgivu's full-sized avatar

Nam G VU namgivu

View GitHub Profile
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.webui.driver.DriverFactory
import org.openqa.selenium.WebDriver
import org.openqa.selenium.remote.RemoteWebDriver
import com.kms.katalon.core.webui.driver.SmartWaitWebDriver
import org.openqa.selenium.support.events.EventFiringWebDriver
import org.openqa.selenium.chrome.ChromeDriver
# bit.ly/nnbashtimestamp
log_fielname_w_timestamp=log-`date +%Y%m%d_%H%M%S_%N`
@namgivu
namgivu / split-by-space.sh
Last active November 10, 2022 07:30
split by space in bash
: YOUR_CMD | awk '{print $1" "$2}'
# ls 1st item
ls | awk '{print $1}' | head -n1
# sample on ls
ls -lah | awk '{print " chmod="$1 " chown="$3" "$4 " size="$5 }'
syntax ref. https://unix.stackexchange.com/a/48104/17671
```
TZ=Asia/Singapore date '+%Y%m%d_%H%M%S_%N'
```
sample
```bash
$ TZ=Asia/Singapore date
Tue Mar 10 12:43:28 +08 2020
alias nonewlinepaste='history -s `xsel -b`; sleep 1; xdotool key Up 1>/dev/null' # xsel ref. https://unix.stackexchange.com/a/96398/17671 # xdotool ref. https://unix.stackexchange.com/questions/267704/command-to-simulate-keyboard-input#comment1038650_267705
@namgivu
namgivu / test-postgres.sh
Created January 9, 2020 05:36
test psql at specific ip:port
# ref. https://stackoverflow.com/a/59657648/248616
echo 'QUIT' | nc -w SECONDS YOUR_HOST PORT; echo $?
# eg
echo 'QUIT' | nc -w 1 localhost 5432; echo $?
increase swap file size to 8Gb
ref. https://askubuntu.com/a/1075516/22308
```bash
sudo swapoff /swapfile ; _='# make all swap off';
sudo rm -rf /swapfile ; _='# remove the current';
_='# 16*1024Mb=16384Mb
sudo dd if=/dev/zero of=/swapfile bs=1M count=16384 ; _='# set swapfile size to 16Gb';
sudo dd if=/dev/zero of=/swapfile bs=1M count=8192 ; _='# set swapfile size to 8Gb';
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 ; _='# set swapfile size to 4Gb';
import unittest
def setUpModule(): pass # nothing here for now
def tearDownModule(): pass # nothing here for now
class Test(unittest.TestCase):
def setUp(self): pass # nothing here for now
def tearDown(self): pass # nothing here for now
import unittest
def setUpModule(): pass # nothing here for now
def tearDownModule(): pass # nothing here for now
def f_no_exception():
pass
EXCEPTION_MSG = f'some error from f_with_exception'