Skip to content

Instantly share code, notes, and snippets.

View dsavchenko's full-sized avatar

Denys Savchenko dsavchenko

  • Astroparticule et Cosmologie, CNRS & UPCité
  • Paris
View GitHub Profile
@dsavchenko
dsavchenko / add-k8s-user.sh
Last active July 29, 2025 20:24
Script to add k8s user
#!/bin/bash
# Script to add k8s admin user
# Credit: https://www.frakkingsweet.com/adding-a-full-admin-user-in-kubernetes/
USERNAME=${1}
GROUP=${2}
if [ $# -ne 2 ]; then
echo "Syntax: $(basename "$0") USERNAME GROUP"
@dsavchenko
dsavchenko / ghcr.sh
Created March 4, 2024 15:55 — forked from eggplants/ghcr.sh
How to get information from ghcr Docker Registry HTTP API V2 with curl
#!/usr/bin/env bash
# ref: https://github.community/t/how-to-check-if-a-container-image-exists-on-ghcr/154836/3
# public image's {USER}/{IMAGE}
USER_IMAGE=eggplants/asciiquarium-docker
# get token ('{"token":"***"}' -> '***')
TOKEN="$(
curl "https://ghcr.io/token?scope=repository:${USER_IMAGE}:pull" |
awk -F'"' '$0=$4'
@dsavchenko
dsavchenko / Python-CDATA.py
Last active February 16, 2024 17:18 — forked from zlalanne/Python-CDATA.py
Adds CDATA support to Python ElementTree
import xml.etree.ElementTree as ET
def CDATA(text=None):
element = ET.Element('![CDATA[')
element.text = text
return element
ET._original_serialize_xml = ET._serialize_xml
@dsavchenko
dsavchenko / shortcuts.md
Created February 9, 2024 14:35 — forked from memphys/shortcuts.md
Bash Shortcuts For Maximum Productivity

source: http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/

Command Editing Shortcuts

  • Ctrl + a – go to the start of the command line
  • Ctrl + e – go to the end of the command line
  • Ctrl + k – delete from cursor to the end of the command line
  • Ctrl + u – delete from cursor to the start of the command line
  • Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
  • Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
@dsavchenko
dsavchenko / cycledates.sh
Created October 21, 2023 11:45
Cycle through dates in bash
#!/bin/bash
startdate=`date -d $1 +%Y%m%d` || exit 1
enddate=`date -d $2 +%Y%m%d` || exit 1
d=$startdate
while (( "$d" <= "$enddate" )); do #works between years 1000 9999
echo $d
d=`date -d "$d + 1day" +%Y%m%d`
done