Skip to content

Instantly share code, notes, and snippets.

@rafzei
rafzei / sources.list_22.04
Created April 24, 2022 08:04
Repositories for Ubuntu (21.04, 22.04)
# deb cdrom:[Ubuntu 21.04 _Hirsute Hippo_ - Release amd64 (20210420)]/ hirsute main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://sk.archive.ubuntu.com/ubuntu/ jammy main restricted
# deb-src http://sk.archive.ubuntu.com/ubuntu/ hirsute main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://sk.archive.ubuntu.com/ubuntu/ jammy-updates main restricted
@rafzei
rafzei / date.py
Last active April 24, 2022 08:01
Simple python date with timezone
from datetime import datetime
import pytz
def set_timezone():
timezone = pytz.timezone("Europe/Warsaw")
return timezone
print(datetime.now(tz = set_timezone()))
@rafzei
rafzei / ctr-commands.txt
Created January 24, 2022 10:58
ctr commands
# List images in k8s
ctr --namespace k8s.io image list
# Create etcd snapshot
ctr --namespace k8s.io \
run \
--mount type=bind,src={{ backup_temp_dir.path }}/,dst=/backup/,options=rbind:rw \
--net-host \
--env ETCDCTL_API=3 \
--rm "{{ etcd_image_name.stdout | trim }}" \
@rafzei
rafzei / crictl-commands.txt
Last active October 12, 2022 10:28
crictl commands
# crictl documentation: https://kubernetes.io/docs/tasks/debug-application-cluster/crictl/
# Runtime endpoints:
sudo crictl --runtime-endpoint unix:///run/containerd/containerd.sock
sudo crictl --runtime-endpoint unix:///var/run/dockershim.sock
sudo crictl --runtime-endpoint unix:///run/crio/crio.sock
## Containers
# Get all containers
@rafzei
rafzei / set-ssh-permissions.sh
Created August 11, 2020 19:32
Correct ssh permisions
chmod 700 ~/.ssh
chmod 644 \
~/.ssh/id_rsa.pub \
~/.ssh/known_hosts \
~/.ssh/authorized_keys \
~/.ssh/config
chmod 600 ~/.ssh/id_rsa
@rafzei
rafzei / sources.list_18.04
Last active August 10, 2020 08:28
Repositories for Ubuntu (18.04, 20.04)
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
@rafzei
rafzei / mount_bitlocker_secured_disk.sh
Last active July 2, 2020 16:51
Easy mount/umount Bitlocker encrypted disk with bash script
#!/bin/bash
vars(){
echo "Setting up vars"
dir_bitlocker="/media/bitlocker"
file_dislocker="dislocker-file"
dir_bitlocker_mount="/media/bitlocker_mount"
dislocker="/usr/bin/dislocker"
}
ensure_dislocker(){
@rafzei
rafzei / settings.screen
Last active April 24, 2023 08:19
screen configuration under linux host
# no welcome message
startup_message off
# lines buffor
defscrollback 5000
# 256 colors
attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
@rafzei
rafzei / Vagrantfile
Last active March 29, 2018 07:46
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for