Skip to content

Instantly share code, notes, and snippets.

View kujyp's full-sized avatar

kujyp kujyp

View GitHub Profile
#!/bin/bash
# Tested Environments : Centos6
start_script_on_background() {
echo "nohup ${1} > ${2} &"
nohup ${1} > ${2} &
}
get_script_path() {
SCRIPT=`readlink -e $0`
@kujyp
kujyp / string_cheetsheets.py
Created October 22, 2018 01:10
Python Cheat Sheets
# Does Python have a string 'contains' substring method?
# https://stackoverflow.com/questions/3437059/does-python-have-a-string-contains-substring-method
if "blah" not in somestring:
continue
@kujyp
kujyp / selenium_cheetsheets.py
Created October 22, 2018 01:20
selenium_cheetsheets.py
## Install chrome driver
# https://chromedriver.storage.googleapis.com/index.html?path=2.43/
def execute_with_message(statement):
print("Execute... {}".format(statement))
result = get_result_from_subprocess(statement)
print("Done message=[{}]".format(result))
def get_result_from_subprocess(cmd):
return (subprocess.check_output(cmd, shell=True)).decode("utf-8")
@kujyp
kujyp / cpp_logger.h
Last active October 22, 2018 01:39
C++ logger using cout
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#define LOG_WARN_JYP(str) \
if (WARN <= g_logLevel) { \
LOG_JYP(str) \
};
#define LOG_DEBUG_JYP(str) \
if (DEBUG <= g_logLevel) { \
LOG_JYP(str) \
@kujyp
kujyp / Docker_Cheetsheets.sh
Created October 31, 2018 10:03
Docker Cheetsheets
#### Docker
docker build -t tfn2mt_base -f tfn2mt/Dockerfile.cpu . && docker run --runtime=nvidia -it --rm tfn2mt_base
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<section id="data"></section>
</body>
<script>
@kujyp
kujyp / python_shebangline_test_executable_app.py
Last active November 16, 2018 06:46
python shebang line test
#!/usr/bin/python
import sys
print("sys.version==[{}]".format(sys.version))
@kujyp
kujyp / Github.js
Last active November 20, 2018 18:35
const Github = class {
constructor(id, repo) {
this._base = `https://api.github.com/repos/${id}/${repo}/contents/`;
}
load(path) {
return new Promise((res, rej) => {
const id = 'callback' + Github._id++;
const f = Github[id] = ({data: { content }}) => {
delete Github[id];
@kujyp
kujyp / codespitz_week03.html
Created November 27, 2018 16:00
codespitz_week03
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<img id="a">
<section id="b"></section>
<br/>
@kujyp
kujyp / codespitz_week03.html
Created November 27, 2018 16:00
codespitz_week03
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<img id="a">
<section id="b"></section>
<br/>