Skip to content

Instantly share code, notes, and snippets.

View blokhin's full-sized avatar

Evgeny Blokhin blokhin

View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC2+Ws07d9N+XzLBIHLLH4YsE1zjYJ7QHgck30Tu1+8DkSSzdRkekWGxs1hDLSCBSzVvGkov7y346HEZGokceZA+Qt0PhePjdBLiMQkyYyPy1LPgkgixtg9EygpMfxIQR1Fd1DeZcfFPuSCt7EB/aEP3g9BXwTUuH1qhMZ+Pgtv7Hcbzw4+GWpkQRzKeCI5uLihuv988f9KOybTh4Ei+BShqV7pTVruQcyeV/wbhCgOY10V/6iAc8iDXCYSFAPsfsI0LNt7/ODJRl/S3zWvlq6Pkk0/UHYbag1dTj9iL5T4mXZ3/Jg0UArgRVdJdMra4DXdvihH6OIEebX2+cJEs2SV4YUCaAcYa/3L8N2E58dWFL/lQQeKx96TL+YHTp4ph3pSQhVs6tKN7WTezdiRjF2SwBahPMJtxMVN9neUSnhnsbZhF/c1HCB9zxGqd+wb2XU+ScXlVmc8xHhyJSUsxukWwVaDLLJVUJwX0iqgW1HNRQqW6R3MyyxHA9P4DDdmdt8= root@corvus
ls -force
# battery status
$charge = Get-CimInstance -ClassName Win32_Battery | Select-Object -ExpandProperty EstimatedChargeRemaining
shutdown -r
# ping port
Test-NetConnection -ComputerName 10.99.245.6 -Port 443
@blokhin
blokhin / BANKING
Last active August 29, 2023 22:25
getnewaddress label
read x
walletpassphrase "$x" 60
sendtoaddress 3AoTqnxsDEeeHsPrp90BbiCxCFxGpVk4mM 0.0019462
@blokhin
blokhin / css_svg.js
Last active October 21, 2022 15:23
Embed SVG into CSS style with JavaScript
dom_el.style.backgroundImage = `url("data:image/svg+xml;utf8,<svg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'><circle cx='50' cy='50' r='` + value + `' fill='%2399f' /></svg>")`;
@blokhin
blokhin / server_ssl.cnf
Created June 17, 2022 15:24
Generating the SSL cert by a config
cat server_ssl.cnf
```
[req]
distinguished_name = req_distinguished_name
attributes = req_attributes
req_extensions = v3_req
prompt = no
[req_distinguished_name]
C = DE
@blokhin
blokhin / size.sh
Created November 18, 2021 13:52
Get exact size of directories
#!/bin/sh
find ${1:-.} -type f -exec ls -lnq {} \+ | awk '
BEGIN {sum=0} # initialization for clarity and safety
function pp() {
u="+Ki+Mi+Gi+Ti+Pi+Ei";
split(u,unit,"+");
v=sum;
for(i=1;i<7;i++) {
if(v<1024) break;
v/=1024;
*/6 * * * * python3 /root/delete_hetzner_disabled.py
@blokhin
blokhin / PGSQLs
Last active September 5, 2023 19:43
\dt -- SHOW TABLES
\dT+ -- SHOW TYPES
\du -- SHOW USERS
\d table -- SHOW INFO
CREATE ROLE watcher PASSWORD 'secure' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;
ALTER USER postgres WITH PASSWORD 'secure';
GRANT USAGE ON SCHEMA public TO watcher;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO watcher;
SELECT * FROM pg_stat_database; (show processlist;)
SELECT setval('uploads_id_seq', (SELECT MAX(id) from "uploads"));
@blokhin
blokhin / SHELLs
Last active April 24, 2024 18:40
ssh-copy-id -i ~/.ssh/mykey user@host
export HISTCONTROL=ignorespace
split -l 10000 myfile segment
ssh -nNT -L 9001:host01:22 user@host02
ssh -nNT -L 7777:localhost:8888 user@host02
tar cf - DATA_DIR | gzip --to-stdout --fast | ssh root@host "cd /data; tar xzf -"
tar zc DATA_DIR | ssh root@host "tar zx -C DEST_DIR"
python -m smtpd -n -c DebuggingServer localhost:1025
netstat -nlpt
@blokhin
blokhin / GITs
Last active September 28, 2022 23:11
# common GIT tips
git show HEAD~0:index.html
git log --graph --oneline --date-order --decorate --color --all
git diff --name-status master..somebranch
git diff somebranch master -- myfile
git commit --amend -m "New commit message"
git archive --format zip --output /full/path/to/zipfile.zip master
git archive --format tar --output ~/.tar master
git remote set-url origin git://new.url.here
git shortlog -s -n