- HTTP 形式:
git clone https://github.com/owner/git.git
- SSH 形式:
git clone [email protected]:owner/git.git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 96 core at most | |
calc_rps_cpus() | |
{ | |
local cpu_ids=$(echo $@ | sort) | |
local h=0 | |
local m=0 | |
local l=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://cloud.tencent.com/developer/article/1631874 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:send2ssh() | |
if has("nvim") | |
let ch = sockconnect('tcp', '127.0.0.1:22222') | |
if ch == 0 | |
echomsg "failed to connect 127.0.0.1:22222" | |
endif | |
call chansend(ch, getreg('"')) | |
call chanclose(ch) | |
else | |
let ch = ch_open('127.0.0.1:22222') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to setup? | |
1. local: add sshconfig to your ~/。ssh/config | |
2. local: copy pbcopy.plist to HOME/Library/LaunchAgents/ and load it with: | |
launchctl load -w $HOME/Library/LaunchAgents/pbcopy.plist | |
3. remote: add vimrc to your remote server's vim config file ~/.vimrc | |
4. remote: copy pbcopy to your remote server and make it excutable | |
chmod +x /usr/local/bin/pbcopy | |
5. remote: run vim and yank | |
6. local: paste the yanked content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Generate a password hash, suitable for /etc/shadow | |
Inspired by this code from OpenStack: | |
https://github.com/openstack/nova/blob/stable/grizzly/nova/virt/disk/api.py#L549 | |
Usage: | |
mkpasswd <passwd> [--algo=<hash>] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import re | |
import sys | |
import sqlite3 | |
import zhconv | |
book_name_map = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if grep -q pypi.pdcts.com.cn /etc/hosts; then | |
sed -i "/pypi.pdcts.com.cn/ d" /etc/hosts | |
fi | |
echo "10.1.1.2 pypi.pdcts.com.cn" >> /etc/hosts | |
mkdir -p ~/.pip/ | |
touch ~/.pip/pip.conf |
This is an example of a socket-activated per-connection service (which is usually referred to as inetd-like service). A thorough explanation can be found at http://0pointer.de/blog/projects/inetd.html.
The key point here is to specify Accept=yes
, which will make the socket accept connections (behaving like inetd) and pass
only the resulting connection socket to the service handler.
NewerOlder