Skip to content

Instantly share code, notes, and snippets.

Avatar

Petr Michalec epcim

View GitHub Profile
@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
View reencrypt.sh
#!/bin/bash
checkusage() {
[[ $# -lt 2 ]] && err_exit 'Usage: reencrypt.sh KEY_ID FILE...'
}
err() { echo -e "$@" >&2; }
err_exit() {
err "$@"
@epcim
epcim / update-ca-certificates.md
Last active April 24, 2023 09:23
trusted certificates system update-ca-certificates
View update-ca-certificates.md

Adding trusted root certificates to the server

Mac OS X

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/new-root-certificate.crt
sudo security delete-certificate -c "<name of existing certificate>"

Windows

certutil -addstore -f "ROOT" new-root-certificate.crt

@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
View ipxe_with_dhcp.txt
#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 / kubernetes_pods_docker_disk_usage.md
Last active April 11, 2023 23:26
docker disk space introspection kubernetes docker overlay
View kubernetes_pods_docker_disk_usage.md

identify big pods/containers

investigage big files

DST=/mnt
find /var/lib -type f -size +1G -exec ls -lh {} \; | tee  $DST/bigfiles_var_lib_$(date "+%H%M").log
find /var/lib -type f -size +1G -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -rh > $DST/bigfiles_var_lib_$(date "+%H%M").sorted.log

misbehave processes

@epcim
epcim / Makefile-vars.md
Created March 30, 2023 11:08
makefile vars from env
View Makefile-vars.md

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

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

all:
  @echo $(TMPDIR)
@epcim
epcim / emoticons-ascii.howto.md
Last active March 22, 2023 19:57
emoticons-ascii.howto.md
View emoticons-ascii.howto.md

Fucking work, nothing works as expected.

   ┓┏┓┏┓┃ 
   ┛┗┛┗┛┃\○/ 
   ┓┏┓┏┓┃ / Jdu se zabit
   ┛┗┛┗┛┃ノ) 
   ┓┏┓┏┓┃ 
   ┛┗┛┗┛┃ 
 ┓┏┓┏┓┃ 
@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
View pass-getting-started.md

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
View gist:224bd5507719b9bd253f1a43a7ff7488
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
View query: show metrics & alerts per source
```
{__name__=~".+",site=~"gc1-iad-01",pod=~"(keycloak-s1-).*"}
```
View vim-go-cheatsheet.md

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