Skip to content

Instantly share code, notes, and snippets.

View epcim's full-sized avatar

Petr Michalec epcim

View GitHub Profile
@epcim
epcim / gist:f271212e031202d040ff8128804d4b40
Created September 15, 2024 06:56
stop disk in linux - hot swap
# for hdd
device=sata4; sudo sh -c "echo 1 > /sys/block/${device}/device/delete"
# for usb
udisksctl power-off -b /dev/sdd
@epcim
epcim / uploads-per-month.txt
Last active August 22, 2024 08:15
gcr.io image statistics
for REPO in $(gcloud alpha container images list --repository=gcr.io/volterraio --sort-by="~TIMESTAMP"|grep -Ev '^NAME'); do \
gcloud container images list-tags $REPO --format="table[no-heading](DIGEST,TIMESTAMP)"|\
grep 2024-08 | xargs -I% echo $(basename $REPO) %; done |\
clipivot count --rows=0 --val=3 |sort -g -t, -k2 -r |head -n 50
❯ sudo sntp -sS time.apple.com
Password:
+9763418.309211 +/- 0.019967 time.apple.com 17.253.14.253
@epcim
epcim / reencrypt.sh
Created April 28, 2023 11:30 — forked from sometimesfood/reencrypt.sh
Small script that re-encrypts GPG-encrypted files with a new key
#!/bin/bash
checkusage() {
[[ $# -lt 2 ]] && err_exit 'Usage: reencrypt.sh KEY_ID FILE...'
}
err() { echo -e "$@" >&2; }
err_exit() {
err "$@"
@epcim
epcim / ipxe_with_dhcp.txt
Created April 13, 2023 08:33 — forked from tuxfight3r/ipxe_with_dhcp.txt
ipxe kickstart over http - dhcp and static configuration
#clone the repo
git clone http://git.ipxe.org/ipxe.git
cd ipxe/src
cat >ubuntu-amd64-installer.ipxe <<EOF
#!ipxe
dhcp
echo Starting Ubuntu x64 installer for ${hostname}
set base-url http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64
kernel ${base-url}/linux
@epcim
epcim / Makefile-vars.md
Created March 30, 2023 11:08
makefile vars from env

scenarios: TMPDIR=new/path make and make TMPDIR=new/path

SHELL  := env TMPDIR=$(TMPDIR) $(SHELL)
TMPDIR ?= "/tmp"

all:
  @echo $(TMPDIR)
@epcim
epcim / pass-getting-started.md
Created March 17, 2023 13:39 — forked from layoaster/pass-getting-started.md
Cheat sheet/ getting-started guide to pass

pass cheat sheet/guide

Getting started guide to the unix password manager pass. Manage gpg encripted passwords (files) in a standar directory-like hierarchy. Such files can be copied or stored in a git repository.

Requirements

  1. Install [pass][pass-homepage] (standard unix password manager):

Ubuntu/Debian:

$ sudo apt-get install pass
tar cvJ /etc/vpm/ | age -r $(curl -qsSL https://f.apealive.net/pub/$USER.age.pub) | croc send
Receiving side
# cat croc-stdin-2310548854 | age -d -i <(pass show age-$USER-public) | tar xvJ
```
{__name__=~".+",site=~"gc1-iad-01",pod=~"(keycloak-s1-).*"}
```

VIM-GO

Plugin https://github.com/fatih/vim-go
Tutorial https://github.com/fatih/vim-go-tutorial
Vimrc https://github.com/fatih/dotfiles/blob/master/vimrc

Run

Commands

  • File :GoRun %
  • Package :GoRun
  • Debug :GoDebugStart