Skip to content

Instantly share code, notes, and snippets.

View goddoe's full-sized avatar

Sungju Kim goddoe

View GitHub Profile
@goddoe
goddoe / check_open_port.sh
Created July 27, 2018 03:04
check open port
# -l = only services which are listening on some port
# -n = show port number, don't try to resolve the service name
# -t = tcp ports
# -u = udp ports
# -p = name of the program
netstat -lntu
@goddoe
goddoe / move.md
Created July 30, 2018 00:35
move between multiple windows in vim

multiple windows

If you want, you can probably do everything from one vim session! :) Here are some commands to turn one vim session (inside one xterm) into multiple windows.

 :e filename      - edit another file
 :split filename  - split window and load another file
 ctrl-w up arrow  - move cursor up a window
 ctrl-w ctrl-w    - move cursor to another window (cycle)
 ctrl-w_          - maximize current window
 ctrl-w= - make all equal size
@goddoe
goddoe / swap between split windows in vim.md
Created July 30, 2018 00:39
swap between split windows in vim

Reference : https://stackoverflow.com/questions/2228353/how-to-swap-files-between-windows-in-vim author : DrAl https://stackoverflow.com/users/72791/dral

There are a few useful commands built in which give you a certain amount of control, but it's not comprehensive. The main ones are:

Ctrl-W, r (i.e. hold CTRL, press W, release CTRL, press r) - which rotates the windows (The first window becomes the second one, the second one becomes the third one, etc.)
Ctrl-W, x - swap the current window with the next one
Ctrl-W, Shift-H - move this window to the far left
Ctrl-W, Shift-K - move this window to the top
@goddoe
goddoe / enable xterm-clipboard.md
Last active July 31, 2018 02:24
enable xterm-clipboard
@goddoe
goddoe / unittest discover.md
Last active August 1, 2018 02:23
python unittest discover
@goddoe
goddoe / ctrl-P open with new split.md
Created August 1, 2018 03:40
vim : ctrl-P open with new split
Use <c-t> or <c-v>, <c-x> to open the selected entry in a new tab or in a new split.
@goddoe
goddoe / like_like.md
Created August 1, 2018 09:44
'LIKE' like clause in Cypher queries.
MATCH (n) WHERE n.name =~ '(?i).*SUBSTRING.*' RETURN n;
@goddoe
goddoe / proc_kill_flush_redis.sh
Created August 2, 2018 01:39
process kill & flush redis
pkill -9 -f "app.py"
redis-cli FLUSHDB
@goddoe
goddoe / timeit.py
Created August 7, 2018 03:04
timeit
import timeit
n = 100
t = timeit.timeit("policy_eval(random_policy, env)", globals=globals(), number = n) / n
print("avg time: {}".format(t))
@goddoe
goddoe / tmux_copy_paste.txt
Created August 7, 2018 09:20
tmux copy paste
referece: https://awhan.wordpress.com/2010/06/20/copy-paste-in-tmux/#comment-342
i m assuming that the tmux prefix is Control+b and that you have emacs style key bindings on
1) enter copy mode using Control+b [
2) navigate to beginning of text, you want to select and hit Control+Space
3) move around using arrow keys to select region
4) when you reach end of region simply hit Alt+w to copy the region
5) now Control+b ] will paste the selection
you can navigate the text using the emacs style navigation key