Skip to content

Instantly share code, notes, and snippets.

Avatar
🌊
파도가 철썩 철썩 철썩

Roeniss Moon roeniss

🌊
파도가 철썩 철썩 철썩
View GitHub Profile
@roeniss
roeniss / visualize_tolower.py
Last active Jul 1, 2022
Tony Finch - tolower() in bulk at speed
View visualize_tolower.py
# This is based on the post "2022-06-27 – tolower() in bulk at speed" by Tony Finch
# link: https://dotat.at/@/2022-06-27-tolower-swar.html
## For me, it was quite hard to understand the post without some visual helps. So I made it.
## You can run this with python3 in terminal and I hope this would help you, too.
OCTETS = "ABSOLUTE"
def show_ascii(s):
bins = bin(s)[2:].zfill(64)
@roeniss
roeniss / create_and_access_ec2.sh
Last active Sep 27, 2022
Instant launching ec2 using awscli
View create_and_access_ec2.sh
# Reference gist: https://gist.github.com/gordonmurray/4e6541f689205db3eb9bddc17a95fb1c
export AMI_ID="ami-033a6a056910d1137" # 2022.03 latest amazon linux 2 AMI
export AWS_PROFILE="roeniss"
export AWS_REGION="ap-northeast-2"
export INSTANCE_TYPE="t2.medium"
export KEY_PAIR_NAME="onetime_keypair_$(uuidgen)"
export SECURITY_GROUP_NAME="onetime_security_group_$(uuidgen)"
# Create ec2 with keypair then echo public DNS
@roeniss
roeniss / push_or_create_branch.sh
Created Jan 27, 2022
git push but always success even if remote branch is not created yet
View push_or_create_branch.sh
git push || git push 2>&1 | sed -n 4p | bash
@roeniss
roeniss / create_groups.py
Last active Nov 14, 2021
Random group maker
View create_groups.py
# -*- coding: utf-8 -*-
import random
# ____ _____ ____ __ __ ______ ____ ____
# /\ _`\ /\ __`\/\ _`\ /\ \/\ \/\__ _\/\ _`\ /\ _`\
# \ \ \L\ \ \ \/\ \ \ \L\_\ \ `\\ \/_/\ \/\ \,\L\_\ \,\L\_\
# \ \ , /\ \ \ \ \ \ _\L\ \ , ` \ \ \ \ \/_\__ \\/_\__ \
# \ \ \\ \\ \ \_\ \ \ \L\ \ \ \`\ \ \_\ \__/\ \L\ \/\ \L\ \
# \ \_\ \_\ \_____\ \____/\ \_\ \_\/\_____\ `\____\ `\____\
# \/_/\/ /\/_____/\/___/ \/_/\/_/\/_____/\/_____/\/_____/ 2021.11.15
View buildImage.sh
#!/usr/bin/env sh
dk build -t tmp --no-cache --progress=plain .
@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 !