Skip to content

Instantly share code, notes, and snippets.


Alex Simenduev shamil

View GitHub Profile
shamil / alertmanager.yml
Last active Aug 27, 2021
Prometheus - better slack messages
View alertmanager.yml
- name: default
- api_url:
channel: alerts
send_resolved: true
title: '' # important, put empty string here
text: '{{ template "slack.shamil.text" . }}'
shamil /
Last active Jan 23, 2023 — forked from notheotherben/
Fix Postgres 9.x Sequences

PostgreSQL 9.x Sequence Fixing Script

This script is intended to automatically fix the sequence numbers for all tables in the current database.

This is accomplished through the use of the setval() command, which we provide with the next ID value we wish to make use of. We use the setval(sequence, number, is_called) overload and set is_called = false in conjunction with COALESCE(MAX + 1, 1) to ensure that, with an empty table, the next sequence value is 1 as expected.


shamil /
Last active Dec 28, 2017
Displaying a remote SSL certificate details using CLI tools


nmap -p 443 --script ssl-cert

The -p 443 specifies to scan port 443 only. All ports will be scanned if it is omitted, and the certificate details for any SSL service that is found will be displayed. The --script ssl-cert tells the Nmap scripting engine to run only the ssl-cert script. From the doc, this script "(r)etrieves a server's SSL certificate. The amount of information printed about the certificate depends on the verbosity level."

Sample output:

Starting Nmap 7.40 ( ) at 2017-11-01 13:35 PDT

Nmap scan report for (

shamil /
Last active Jan 9, 2023
Rundeck executions cleanup
#!/bin/bash -e
# see related issue:
# export required vars
export RD_URL=http://localhost:4440 RD_USER=admin RD_PASSWORD=admin RD_HTTP_TIMEOUT=300
# make sure rd & jq commands are in the PATH
which -- rd jq >/dev/null
del_executions() {
shamil /
Last active Jul 7, 2021 — forked from FreeTymeKiyan/
An example python script to reroute unassigned shards to NODE_NAME node thus recovering from the red cluster status
#!/usr/bin/env python3
# An example python script to reroute unassigned shards to NODE_NAME node,
# thus recovering from the red cluster status
# pip install requests before using requests
import requests
import json
shamil /
Created Feb 24, 2017
TFTP server on Fedora


TFTP server on Fedora

Here are some quick notes on setting up a TFTP server on Fedora 23. This is used, for example, to send Linux kernel images and other binaries to a bootloader on an embedded system.

First, install the packages:

sudo dnf install -y tftp tftp-server

sudo rm -fr /opt/franz
sudo rm -fr /usr/share/applications/franz.desktop
# create installation dir
sudo mkdir -p /opt/franz
#install franz
View read-access.sql
-- PostgreSQL, create read-only user
-- Option 1
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
shamil / gcr-tags.go
Last active Aug 22, 2016 — forked from rjeczalik/gcr-tags.go
Reads a tag list for Google Container Registry for the given image.
View gcr-tags.go
package main
import (
shamil /
Created Aug 27, 2015
Viewing stacktrace of running process using GDB

Viewing stacktrace of running process using GDB

to view stacktrace of running process, run

sudo gdb -batch -quiet -nx -ex "backtrace full" -p <PID>

to view stacktrace of running process for all threads, run

sudo gdb -batch -quiet -nx -ex "thread apply all backtrace full" -p