Skip to content

Instantly share code, notes, and snippets.

View kiyoon's full-sized avatar

Kiyoon Kim kiyoon

View GitHub Profile
@kiyoon
kiyoon / starship.toml
Last active December 20, 2022 18:08 — forked from ryo-ARAKI/starship.toml
Starship configuration file
# ~/.config/starship.toml
[battery]
full_symbol = "🔋"
charging_symbol = "🔌"
discharging_symbol = "⚡"
[[battery.display]]
threshold = 30
style = "bold red"
@kiyoon
kiyoon / text_to_excel_clipboard.py
Last active April 4, 2022 15:52
Copy list of numbers to clipboard so you can paste on Excel sheets.
#!/usr/bin/env python3
# Requirements
# pip3 install pandas
# sudo apt install xclip
import pandas as pd
import numpy as np
import argparse
@kiyoon
kiyoon / Python_gui_executable_conda.sh
Last active May 18, 2022 23:06
Create Python executable under conda environment
#!/bin/bash
# Make this script executable by
# chmod +x Python_gui_executable_conda.sh
# On Mac,
# go to properties of the file, choose open with, Terminal.app in Utilities folder.
# On Ubuntu you need to make another file.
# Follow the `ubuntu.desktop` script.
#!/bin/bash
# If you don't have conda installed, run these in advance.
#wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
#bash Miniconda3-latest-Linux-x86_64.sh
# Run the script using `source epic_viewer_setup.sh`.
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]
then
@kiyoon
kiyoon / start_ngrok_telegram_bot.sh
Created March 11, 2022 13:38 — forked from obokaman-com/start_ngrok_telegram_bot.sh
A bash script to start Ngrok in background, and send ngrok URL to a Telegram Bot automatically, copying the remote URL to clipboard
#!/usr/bin/env bash
# Start NGROK in background
echo "⚡️ Starting ngrok"
ngrok http 8080 > /dev/null &
# Wait for ngrok to be available
while ! nc -z localhost 4040; do
sleep 1/5 # wait Ngrok to be available
done
#!/bin/bash
# If you don't have conda installed, run these in advance.
#wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
#bash Miniconda3-latest-Linux-x86_64.sh
# Run the script using `source epic_viewer_setup.sh`.
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]
then
@kiyoon
kiyoon / camera_webcam.sh
Last active December 2, 2021 10:22
Canon Camera Webcam with Ubuntu
# https://community.usa.canon.com/t5/Camera-Software/When-available-Canon-EOS-Utility-for-Linux-Ubuntu/td-p/314449
# https://www.crackedthecode.co/how-to-use-your-dslr-as-a-webcam-in-linux/
pkill -9 gvfs-gphoto2-volume-monitor
pkill -9 gvfsd-gphoto2
# CPU
gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0
# GPU
@kiyoon
kiyoon / save_stdouterr_print_err.sh
Created December 2, 2021 02:38
Bash: save both stdout and stderr separately, whilst printing stderr.
# https://stackoverflow.com/questions/9112979/pipe-stdout-and-stderr-to-two-different-processes-in-shell-script
# Executes the command, prints the errors, and save the stdout and stderr as separate files.
save_stdouterr_print_err () {
commandstr="$1"
stdoutpath="$2"
stderrpath="$3"
if [[ $# -lt 4 ]]
then
SSH_EVAL='eval'
else
@kiyoon
kiyoon / get_slurm_master_node.py
Created July 22, 2021 20:07
Get Slurm master node address from $SLURM_NODELIST
### get the first node name as master address
### e.g. master(aislab-[2-5],gnoded1) == aislab-2
import argparse
def get_parser():
parser = argparse.ArgumentParser(description="Extract master node name from Slurm node list",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("nodelist", help="Slurm nodelist")
return parser
@kiyoon
kiyoon / eddie_server.md
Last active August 17, 2021 05:15
Slurm cheatsheet

Node summary

qstat -F gpus,gputype,mem_total -q gpu

Interactive session

qlogin -pe gpu-titanx 1