Skip to content

Instantly share code, notes, and snippets.

View epcim's full-sized avatar

Petr Michalec epcim

View GitHub Profile
View gist:9bf3c82a13ccef3c02dda5116a92f886
❯ 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
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 / 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 / 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 / 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
@epcim
epcim / gist:8434d2f7cae31ab77c620f1f321286bd
Created January 21, 2023 14:19
network debug api siege performance
View gist:8434d2f7cae31ab77c620f1f321286bd
```
apt install siege -y
siege -c 255 -t 5m https://my.tls.host/api/status
```
@epcim
epcim / cshell
Created August 5, 2022 08:46
k8s container docker exec
View cshell
# enter any kubernetes pod/container directly just by "part" of it's cotnainer name
cshell ()
{
d=$1;
docker exec -it $(docker ps |grep "k8s_$d" | awk '{print $1}' | head -1) /bin/bash
}