Skip to content

Instantly share code, notes, and snippets.

View evanjuang's full-sized avatar

Juang JiaYu evanjuang

  • Taoyuan, Taiwan
View GitHub Profile
@evanjuang
evanjuang / app.bat
Last active April 17, 2019 08:13
[java - start java application by script] #java #windows #linux #shell
@ECHO off
SET APP_NAME=app
REM Get Home Directory
SET APP_PATH=%~dp0
SET APP_HOME=%APP_PATH:~0,-5%
REM Project Information
@evanjuang
evanjuang / nagios-on-centos7.md
Last active April 17, 2019 08:01
[nagios - install on centos 7] #nagios

Nagios on CentOS 7

Install Nagios Core

  1. Install package
$ yum install wget httpd php glibc glibc-common gd gd-devel 
make net-snmp unzip openssl-devel gcc
  1. Add user
$ useradd nagios -p nagios
@evanjuang
evanjuang / WebServer.py
Last active November 17, 2020 13:01 — forked from joncardasis/WebServer.py
[python - simple web server] A simple and quick HTTP web server in Python #python
"""
Author: Jonathan Cardasis
"""
import socket
import signal # Allow socket destruction on Ctrl+C
import sys
import time
import threading
@evanjuang
evanjuang / argparse_usage.py
Last active April 17, 2019 08:07
[python - argparse] #python
subcmd = parser.add_subparsers(description='command description',
title='command title',
help='command help',
dest='cmd',
metavar='command metavar',
prog='command prog')
subcmd.add_parser('cmd1', help='cmd1 help')
@evanjuang
evanjuang / shell-cli-template.sh
Last active April 17, 2019 08:08
[shell - simple cli template] #shell
#!/bin/bash
usage() {
echo "Usage:"
echo " $(basename "$0") -u <username> -p <password> -a <api>"
exit
}
if [ "$#" -ne 6 ]; then
usage
@evanjuang
evanjuang / init.vim
Last active April 17, 2019 08:10
[devtool - neovim] #linux #devtool
" ==================== VIM PLUG ==================
call plug#begin()
" autocompletion (also a linter - diagnostics)
" Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer' }
" airline (powerline)
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
@evanjuang
evanjuang / wsl-setup.md
Last active April 17, 2019 08:12
[devtool - wsl ubuntu] #windows #linux #devtool
@evanjuang
evanjuang / find_mount_info.sh
Created November 16, 2020 03:42
[mount info] #shell #snippet
cat /proc/self/mountinfo | grep /home/repo | awk '{print $4 " ==> " $5}'
# output to markdown format
echo -e "|source|dest|\n|----|----|" > out.md
cat /proc/self/mountinfo | grep /home/repo | awk '{printf "|%s|%s|\n", $4, $5}' >> out.md
@evanjuang
evanjuang / clean_py.sh
Created November 20, 2020 07:09
[clean python build find] #python #shell
find . -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
@evanjuang
evanjuang / exceptions.py
Last active June 18, 2021 03:51
Python requests sample code
class HTTPRequestError(Exception):
pass
class HTTPClientError(Exception):
pass
class HTTPServerError(Exception):
pass