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 / autotyper.scpt
Last active August 14, 2023 15:13
Apple script to auto type clipboard contents. To use in the macOS Automator Quick Action
on run {input, parameters}
tell application "System Events"
set textToType to (get the clipboard as text)
delay 1
repeat with i from 1 to count characters of textToType
set c to character i of textToType
-- use codes to print some chars for compatibility reasons
-- see https://eastmanreference.com/complete-list-of-applescript-key-codes for all key codes
if c = "." then
@vi7
vi7 / smtp4dev_k8s_manifests.yaml
Created August 2, 2023 12:02
K8S deployment manifests for a dummy lightweight SMTP email server (smtp4dev) with WebUI useful for development and testing
---
apiVersion: v1
kind: Service
metadata:
name: smtp4dev
spec:
type: NodePort
selector:
app: smtp4dev
ports:
@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)