Skip to content

Instantly share code, notes, and snippets.

ppdouble / couting-source-code
Created February 7, 2024 03:08
counting line of the source codes
find . -name '*.java' | xargs wc -l
ppdouble /
Last active September 11, 2023 04:36
Create Hotspot with WEP
[user@fdr-lnx ~]$ nmcli connection down MyFedoraHotspot
Connection 'MyFedoraHotspot' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/16)
[user@fdr-lnx ~]$ nmcli connection delete MyFedoraHotspot
Connection 'MyFedoraHotspot' (076c78bf-9e91-4779-832e-7306adb7b277) successfully deleted.
[user@fdr-lnx ~]$ ls -lh /etc/NetworkManager/system-connections/ | grep MyFedoraHotspot
[user@fdr-lnx ~]$ nmcli con add type wifi ifname wlp0s30f4 con-name MyFedoraHotspot autoconnect yes ssid MyFedoraHotspot
Connection 'MyFedoraHotspot' (9ec71f65-881b-43b3-b666-710a21d5c6a9) successfully added.
[user@fdr-lnx ~]$ nmcli con modify MyFedoraHotspot 802-11-wireless.mode ap bg ipv4.method shared
[user@fdr-lnx ~]$ nmcli con modify MyFedoraHotspot wifi-sec.key-mgmt none
Warning: WEP encryption is known to be insecure.
ppdouble /
Created August 18, 2023 09:04
git change pushed commit comment
git commit --amend -m "New commit message."
git push --force <remoteName> <branchName>
ppdouble /
Created July 20, 2023 06:28
Generate time sequence in bash
for i in $(seq -w 1 02);
for j in $(seq -w 10);
for k in $(seq -w 16);
printf '%s:%s:%s,\t' "$i" "$j" "$k";
ppdouble /
Last active July 21, 2023 10:11
Copy files from remote host to local machine with specific port using rsync. Alternative of scp. To copy a large number of files from remote.
# copy files from remote host with specific ssh port
rsync -havzP -e "ssh -p portNumber" /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
ppdouble /
Last active July 13, 2023 00:40
Encrypt Util for AES ECB PKC5 in python3
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):
ppdouble /
Created June 27, 2023 16:22
Create 32 length random String in bash
cat /dev/urandom | tr -cd 'a-zA-Z0-9' | head -c 32 | xargs
ppdouble /
Last active June 9, 2023 00:04
generate 2048 bits rsa public private key pair for jwt token
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-----
ppdouble /
Created June 1, 2023 11:18
loop curl request
for ((i=1; i<=50; i++)); do curl -X POST; echo ""; done;
ppdouble /
Created May 24, 2023 15:44
Download service using
#!/usr/bin/env python
import web
urls = (
'/', 'index'
class index: