This file contains hidden or 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
curl -vX POST 127.0.0.1:8888/my/api?para1=123 -H 'Content-Type: application/json' -d @/home/path/to/mydata.json | |
# mydata.json | |
# { | |
# "para": "m", | |
# "data": { | |
# "d1": "111", | |
# "d2": "222" | |
# } | |
# } |
This file contains hidden or 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
# the paths of jar files are listed in a text file named "files" | |
find $(cat files) -print -exec zipgrep "the-characters-needed-to-be-searched" '{}' \; | |
# search jar files recursively in path the-folder-path | |
find the-folder-path -name "*.jar" | xargs -I{} sh -c 'echo searching in "{}"; zipgrep "the-characters-needed-to-be-searched" {}' |
This file contains hidden or 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 web | |
urls = ( | |
'/', 'index' | |
) | |
class index: |
This file contains hidden or 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
for ((i=1; i<=50; i++)); do curl -X POST http://127.0.0.1:8090/myapi/demo; echo ""; done; |
This file contains hidden or 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
jwtkey=/home/jwt/sign/keys | |
mkdir -p $jwtkey | |
openssl genrsa -out $jwtkey/rsa-prv.pem 2048 | |
openssl rsa -in $jwtkey/rsa-prv.pem -pubout > $jwtkey/rsa-pub.pem | |
# OpenSSL `1.0.2k-fips on 26 Jan 2017` on `CentOS Linux release 7.9.2009 (Core)` gives pkcs#1 with -----BEGIN RSA PRIVATE KEY----- | |
# OpenSSL `3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)` on `Fedora release 38 (Thirty Eight)` gives pkcs#8 with -----BEGIN PRIVATE KEY----- |
This file contains hidden or 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
cat /dev/urandom | tr -cd 'a-zA-Z0-9' | head -c 32 | xargs |
This file contains hidden or 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
import base64 | |
import subprocess | |
from Crypto.Cipher import AES | |
from Crypto.Util.Padding import pad, unpad | |
# Python 3.11.3 | |
# pycryptodome-3.18.0-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | |
def pad_pkcs5(byte_array: bytearray, block_size: int): | |
""" |
This file contains hidden or 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://stackoverflow.com/questions/9090817/copying-files-using-rsync-from-remote-server-to-local-machine | |
# https://explainshell.com/explain?cmd=rsync+-havzP+-e+%22ssh+-p+%24portNumber%22+user%40remote.host%3A%2Fpath%2Fto%2Fcopy+%2Flocal%2Fpath | |
# copy files from remote host with specific ssh port | |
rsync -havzP -e "ssh -p portNumber" [email protected]:/path/to/copy /local/path | |
# copy abc into local def | |
rsync -avzP user@remote-host:/source/folder/abc /destinate/folder/def/ | |
# copy the files in abc into local abc |
This file contains hidden or 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
for i in $(seq -w 1 02); | |
do | |
for j in $(seq -w 10); | |
do | |
for k in $(seq -w 16); | |
do | |
printf '%s:%s:%s,\t' "$i" "$j" "$k"; | |
done | |
done | |
done |
This file contains hidden or 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
git commit --amend -m "New commit message." | |
git push --force <remoteName> <branchName> | |
# https://linuxize.com/post/change-git-commit-message/ |