Skip to content

Instantly share code, notes, and snippets.

View vi7's full-sized avatar
💭
smd

Vitaliy D. vi7

💭
smd
  • Krakow, Poland
View GitHub Profile
@vi7
vi7 / kernels_cleanup.sh
Last active November 11, 2022 09:37
Script that retains the latest kernel and removes old kernels if any. DNF compatible
#!/usr/bin/env bash
old_kernels=($(dnf repoquery --installonly --latest-limit=-1 -q))
if [ "${#old_kernels[@]}" -eq 0 ]; then
echo "No old kernels found"
exit 0
fi
if ! dnf remove "${old_kernels[@]}"; then
echo "Failed to remove old kernels"
@vi7
vi7 / check_version.sh
Created September 9, 2022 04:53
Script to check if app version has been bumped. To be used with Merge Request CI checks
#!/usr/bin/env sh
# Script to check if app version has been bumped
# To be used with Merge Request CI checks
set -e
VERSION_FILE="ci/build.env"
git fetch origin
@vi7
vi7 / kernel_v5_centos7.sh
Created August 3, 2022 13:15
Kernel v5 on CentOS 7
#!/usr/bin/env bash
# Based on the info from
# - http://elrepo.org/tiki/HomePage
# - https://www.golinuxcloud.com/set-default-boot-kernel-version-old-previous-rhel-linux/
# - https://www.casesup.com/category/knowledgebase/howtos/how-to-change-the-default-kernel-in-grub-for--rhel-and-centos
## !!!!!!!!!!!!!!!!!!!! ##
## ##
## !!! IMPORTANT: do not run this as-is, read all in-line comments ##
@vi7
vi7 / 00_Node_exporter_installer_script_for_AsusWRT_Merlin.md
Last active May 2, 2022 19:50
Prometheus Node Exporter installer script for AsusWRT Merlin routers with config examples

Prometheus Node Exporter installer script for AsusWRT Merlin

Installation

curl -sL https://gist.githubusercontent.com/vi7/bc27529bd4803576fefc479dbd326dfa/raw/node_exporter_installer_asuswrt_merlin.sh | sh \
&& rm -f node_exporter_installer_asuswrt_merlin.sh
@vi7
vi7 / 00_CoreDNS_installer_script_for_AsusWRT_Merlin.md
Last active May 2, 2022 19:38
CoreDNS installer script for AsusWRT Merlin routers with config examples

CoreDNS installer script for AsusWRT Merlin

Installation

curl -sL https://gist.githubusercontent.com/vi7/e41b07ff7d0fb845ac281cd940876e2a/raw/coredns_installer_asuswrt_merlin.sh | sh && rm -f coredns_installer_asuswrt_merlin.sh
@vi7
vi7 / alertmanager.yml
Last active April 15, 2022 12:27
Docker Compose file with Prometheus, Alertmanager, Node Exporter and cAdvisor. Sample configs included.
---
global:
resolve_timeout: 3m
slack_api_url: 'https://hooks.slack.com/services/<TOKEN>'
smtp_smarthost: 'mail.example.com:25'
smtp_from: 'alertmanager-dev@example.com'
smtp_require_tls: false
smtp_hello: 'alertmanager-dev'
# The directory from which notification templates are read.
@vi7
vi7 / devops_basics.md
Last active March 9, 2022 12:31
DevOps basics

DevOps topics

  • Linux command line basics:
    • navigating through directory tree
    • opening text files (logs)
    • checking CPU/Memory/Disk usage
    • checking network ports
    • services (stopping, starting, checking status)
  • Docker and containers overview (what is it and what it is used for)
@vi7
vi7 / close_notifications_applescript.js
Created February 22, 2022 20:56 — forked from lancethomps/close_notifications_applescript.js
AppleScript to close all notifications on macOS Big Sur
function run(input, parameters) {
const appName = "";
const verbose = true;
const scriptName = "close_notifications_applescript";
const CLEAR_ALL_ACTION = "Clear All";
const CLEAR_ALL_ACTION_TOP = "Clear";
const CLOSE_ACTION = "Close";
@vi7
vi7 / git_status_check.sh
Last active December 31, 2021 12:35
Oneliner scripts to check Git working tree status for multiple repositories in a batch
#!/usr/bin/env bash
# Collection of oneliner scripts to check Git working tree status for multiple repositories in a batch
set -e
# The most simple, prints all the git repos found and outputs not commited changes if any
for dir in $(find . -type d -name '.git'); do pushd $dir/.. >/dev/null; pwd; git status --short; popd >/dev/null; done
# Print paths to repositories with uncommitted changes only