Skip to content

Instantly share code, notes, and snippets.

View goddoe's full-sized avatar

Sungju Kim goddoe

View GitHub Profile
@goddoe
goddoe / find word by pattern.sh
Created August 8, 2018 06:07
find word by pattern
find . -name "*.py" | xargs grep 'pattern'
@goddoe
goddoe / break-pane_join-pane.rst
Last active August 7, 2019 03:06
Use the break-pane and join-pane commands. Refer to man tmux for details, options and usage.

Use the break-pane and join-pane commands. Refer to man tmux for details, options and usage.

Hide Pane 3:

Select pane 3 and enter Prefix-:break-pane -dP.

tmux will send pane 3 to a window in the background (the -d flag) and print some information about it in pane 2 (the -P flag). By default you'll see something like 1:2.0 (meaning: session:window.pane). Hit q to continue working.1

1With some practice you you will be able to drop the -P flag since you can predict the session:window.pane triplet: session defaults to the current session and pane defaults to 0 while window will be the next free window identifier.

@goddoe
goddoe / tmux-cheatsheet.markdown
Created August 10, 2018 01:11 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@goddoe
goddoe / vim cheatsheet.txt
Created August 10, 2018 01:26
vim cheatsheet
reference: https://www.maketecheasier.com/premium/cheatsheet/vim-keyboard-shortcuts/
Here’s a cheatsheet to help you get the most out of Vim.
Shortcut Keys Function
Main
Escape key Gets out of the current mode into the “command mode”. All keys are bound of commands.
i “Insert mode” for inserting text. Keys behave as expected.
: “Last-line mode” where Vim expects you to enter a command such as to save the document.
reference: http://teohm.com/blog/shortcuts-to-move-faster-in-bash-command-line/
Shortcuts to move faster in Bash command line
Jan 4, 2012
Nowadays, I spend more time in Bash shell, typing longer commands. One of my new year resolutions for this year is to stop using left/right arrow keys to move around in the command line. I learned a few shortcuts a while ago.
Last night, I spent some time to read about “Command Line Editing” in the bash manual. The bash manual is a well-written piece of documentation. I think I should read it more often.
Well, here’s the new shortcuts I learned:
@goddoe
goddoe / remove_local_merged_branch.sh
Created August 10, 2018 02:38
Remove local merged branch.
git branch --merged >/tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches
@goddoe
goddoe / You arent gonna need it.txt
Created August 26, 2018 11:04
You aren't gonna need it
You aren't gonna need it
@goddoe
goddoe / pass_argue_ipytho.md
Created September 3, 2018 14:52
Pass arguments to script with ipython interactive.

I am often asked to debug Python scripts written by others. I would like to send these scripts to IPython so it will drop into an IPython shell at the point the script fails.

Unfortunately, I cannot find a way to send (required) command-line options required by the scripts.

IPython assumes everything in is for IPython when I pass the script and its options as:

ipython <script_name> <script_options> Is there a solution or workaround?

ipython -i -c "%run test.py 1 2 3 4"
docker run -ti --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=6,7 -v /home1/irteam/users/sungju:/root/sungju -p 10080:80 -p 15000:5000 -p 18000:8000 -p 18080:8080 --name sungju nvidia/cuda:9.1-cudnn7-devel-centos7-kr bash
@goddoe
goddoe / jupyter_lab_specify_port_ip.sh
Created September 13, 2018 17:55
jupyter lab specify port, ip
jupyter lab --port=8000 --no-browser --ip='0.0.0.0' --allow-root