Recently I came across a ProxyPool repo, which is a dynamic proxy pool used for web crawling. It is useful for me, so I think I can contribute my effort to benefit others. After adding some other free proxy service providers I found, I need to push my changes to my forked repo on GitHub.com.
I prefer using SSH for convenience and security, so I don’t have to type in my username and password every time. I read about GitHub tutorial on Connecting to GitHub with SSH, and some other sources like Push to github without password using ssh-key and Automatically use correct SSH key for remote Git repo. All the tutorials say to change repo’s remote url to this format:
git remote set-url origin email@example.com:<Username>/<Project>.git but my push fails, and
ssh -T firstname.lastname@example.org gives
Permission denied (publickey) error. Thankfully
ssh -vvv email@example.com shows some interesting hints:
debug1: Trying private key: /Users/username/.ssh/id_rsa
debug3: no such identity: /Users/username/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /Users/username/.ssh/id_dsa
debug3: no such identity: /Users/username/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /Users/username/.ssh/id_ecdsa
debug3: no such identity: /Users/username/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /Users/username/.ssh/id_ed25519
debug3: no such identity: /Users/username/.ssh/id_ed25519: No such file or directory
It seems that with the aforementioned configuration git does not read my
/Users/username/.ssh/config file and will only look for ssh keys with default names, i.e. id_*. I have multiple ssh keys for logging in to my VPS servers, and I rename all the keys accordingly, including this github key pairs. I also create an entry for each server in
/Users/username/.ssh/config file like
so a simple command like
ssh digitalocean will log me into the server. Then how to tell git to look for a Host entry instead? Here is the working remote url format on my machine:
git remote set-url origin <Host>:<Username>/<Project>.git, therefore ssh authentication test command changes to
ssh -T github
I have setup a wordpress site for a friend, but I’m afraid that I cannot remember all the steps and all corresponding commands, so I recorded what I did.
- Edit SSH configuration file, change port, password or disable password login for security, then restart ssh:
service ssh restart
- Change IPTables rules, only allow connections desired ports, close unused ports:
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 12345 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -j DROP
where 12345 is the port number set in the above step.
- By default, IPTables rules are not persistent, i.e. they are reverted to the default after system reboot. To save the rules, install iptables-persistent package:
apt install iptables-persistent
Continue reading How to Setup a WordPress Server
I searched online for a slim Debian system, but I just could not find one. There are installer CDs and DVDs. As I understand, CD versions contain less packages than DVDs versions, so I think it may better suit my needs. But the only two options available to me are as CDs: netinst iso, which I thought will only work well with internet connection, and xfce iso, which contains a desktop environment already, although a lightweight one. My idea is, I want a slim version of Debian Linux system that has only command line interface and core packages installed by default, and I’ll install a display manager, but I won’t install a whole desktop environment.
But to my satisfaction, as I try to install with the net installer in VirtualBox, it doesn’t necessarily need internet connection, it just gets a confusing name. But there is a step in the installation process where the installer detects the network card automatically, so I have to connect a virtual network card to the virtual machine in settings pane.
It took a little longer as I expected, but it was smooth enough. When I get into the command line interface, it becomes quite easy to install GUI to it, all I have to do is
and then issue a command
to get into graphic interface.
Since I have only one display manager installed, the dwm, so that’s enough for me. As I understand, if multiple display managers exist in the system, one has to create a
.xinitrc file in home directory with the command
in it to specify dwm as the display manager to use.
Added Jun 25, 2017: Kary, 我衰記性差，好對唔住，唔應該開你玩笑，求你原諒🌹
I’m currently using an CUSTOMIZED Mac😁 I like the default Terminal.app shipped within macOS. I have changed the appearance a little bit, so it look nice to me. I also wanted to customize it even more, to enable it to sync command history between all open terminal sessions. I have tried
export PROMPT_COMMAND="history -a;history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
and some combinations of them in my .bash_profile, but none of them worked for me properly, so I gave up the idea of syncing. Problems include wrong command history number, failing to remove duplicate command, etc.
Continue reading My .bash_profile on My Mac
As an on-the-way-to-becoming-a-serious developer, I think I had better get familiar with some source code manager software, and that is: Git.
As I learn how to use git, I want to keep track of what I have learned, and keep it down so I can go back and see should I forget it. This is supposed to be a update-if-needed list. So here are some git commands:
Continue reading Some Useful Git Commands