Skip to content

Instantly share code, notes, and snippets.

View lovejavaee's full-sized avatar
👋
Java | C++ | Python | ML | DL

Jeff M lovejavaee

👋
Java | C++ | Python | ML | DL
View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef void (*msg_type)(void);
void msg_1() {
printf("You have done well in this assignment!\n");
}
@lovejavaee
lovejavaee / agr.sh
Created January 22, 2020 05:36
/usr/local/bin/agr
ag -0 -l $1 | xargs -0 sed -ri -e "s/$1/$2/g"
#!/usr/bin/python
"""Custom topology example
Two directly connected switches plus a host for each switch:
host --- switch --- switch --- host
_/ \_
host / \ host
@lovejavaee
lovejavaee / course list.md
Last active August 3, 2020 17:38
NCTU OpenCourseWare
  • 演算法 Algorithms

    • § Required text
        1. J. Kleinberg and E. Tardos, Algorithm Design, Addison Wesley, 2006.
        1. (J. Kleinberg, 20 Best Brains under 40, Discover Magazine, 2008)
    • § Reference book
        1. S. Dasgupta, C. Papadimitriou, and U. Vazirani, Algorithms, McGraw-Hill, 2007.
GPG: Extract private key and import on different machine
After extending the expiry date of a GPG key you might have to copy your key to another machine to use the same key there. Here is how:
Identify your private key by running gpg --list-secret-keys. You need the ID of your private key (second column)
Run this command to export your key: gpg --export-secret-keys $ID > my-private-key.asc
Copy the key to the other machine (scp is your friend)
To import the key, run gpg --import my-private-key.asc
If the key already existed on the second machine, the import will fail saying 'Key already known'. You will have to delete both the private and public key first (gpg --delete-keys and gpg --delete-secret-keys)
Make sure to place username ALL=(ALL) NOPASSWD:ALL beneath %sudo ALL=(ALL:ALL) ALL since it will use the last entry that applies to the user.
You could also just replace %sudo ALL=(ALL:ALL) ALL with %sudo ALL=(ALL) NOPASSWD:ALL and not worry about your entry placement.
https://github.com/Microsoft/WSL/issues/1476
@lovejavaee
lovejavaee / zsh_keybindings.zsh.md
Created September 21, 2018 03:29
zsh bindkey

Zsh keybindings

# Keybindings #
###############

# Keybindings to make special keys work - https://wiki.archlinux.org/index.php/Zsh#Key_Bindings
bindkey -v # vi mode
bindkey "\e[1~" beginning-of-line # Home