Skip to content

Instantly share code, notes, and snippets.

Avatar
🌊
파도가 철썩 철썩 철썩

Roeniss Moon roeniss

🌊
파도가 철썩 철썩 철썩
View GitHub Profile
@roeniss
roeniss / script.sh
Created Jan 19, 2021
bash script template
View script.sh
#!/usr/bin/env bash
set -Eeuxo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
사용법: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@roeniss
roeniss / .eslintrc.json
Last active Sep 2, 2020
nodejs boilerplate snippets
View .eslintrc.json
{
"env": {
"browser": true,
"es2020": true
},
"extends": ["eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
@roeniss
roeniss / show_all_path.sh
Created Apr 6, 2020
show $PATH by one per line
View show_all_path.sh
echo $PATH | tr : \\n | xargs -n1
@roeniss
roeniss / gopen
Last active May 8, 2020
open git remote repository with Chrome
View gopen
#!/bin/bash
# Using Chrome, open a github page of remote repo on current directory.
# tested on MacOS
REMOTE=$(git remote -v | sed -n '1,1p' | sed 's/.*https/https/' | sed 's/\ .*//')
open -a Google\ Chrome $REMOTE
@roeniss
roeniss / send_mail.py
Created Mar 17, 2020
simple python send_mail script (using gmail)
View send_mail.py
# -*- coding: utf-8 -*-
import csv
import os
import smtplib
from email.mime.text import MIMEText
import datetime
def sendGmail(userEmail, emailPassword, emailToBeSend, subject, htmlContent):
'''
Keep secret the PASSWORD !
@roeniss
roeniss / script.sh
Created Feb 16, 2020
npx express-generator with options
View script.sh
#!/bin/bash
npx express-generator -e -v ejs -c sass -f --git .
@roeniss
roeniss / addPlugins.sh
Created Feb 10, 2020
script for adding new plugin to zsh
View addPlugins.sh
# for example,
# plugins=(git)
# will become :
# plugins=(git zsh-autosuggestions)
# with "addPlugin zsh-autosuggestions"
# add below function to ~/.zsrc, then reload with 'source ~/.zshrc'
addPlugin() { l=`cat ~/.zshrc
| grep -n '^plugins=.*$'
| cut -f1 -d:`;
View makeSwap.sh
# original article: [How To Add Swap Space on Ubuntu 16.04](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04)
# Cautious! Upgrading RAM is safer than this job.
# 1. check status
sudo swapon --show # no output == no available swap space
free -h # another way to do right above line
df -h # check available disk
# 2. create/enable swap file
@roeniss
roeniss / letsencript_docker.md
Created Dec 29, 2019
let's encrypt certification / renew with docker
View letsencript_docker.md
new
sudo docker run -it --rm --name certbot \
  -v '/etc/letsencrypt:/etc/letsencrypt' \
  -v '/var/lib/letsencrypt:/var/lib/letsencrypt' \
  certbot/certbot certonly -d '*.myDomain.com' --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory
renew
@roeniss
roeniss / main.cpp
Last active Apr 4, 2021
Boilerplate for program solving
View main.cpp
// 파도가 🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊 철썩 철썩
#include <iostream>
#include <deque>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;