Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Alex Simenduev shamil

🎯
Focusing
Block or report user

Report or block shamil

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shamil
shamil / README.md
Last active Jan 31, 2019 — forked from SPARTAN563/README.md
Fix Postgres 9.x Sequences
View README.md

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.

Running

@shamil
shamil / ssl_info.md
Last active Dec 28, 2017
Displaying a remote SSL certificate details using CLI tools
View ssl_info.md

From: https://serverfault.com/a/881415

nmap -p 443 --script ssl-cert gnupg.org

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 ( https://nmap.org ) at 2017-11-01 13:35 PDT
Nmap scan report for gnupg.org (217.69.76.60)
@shamil
shamil / rundeck_executions_cleanup.sh
Last active Jun 3, 2019
Rundeck executions cleanup
View rundeck_executions_cleanup.sh
#!/bin/bash -e
# see related issue: https://github.com/rundeck/rundeck/issues/357
# 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
shamil / reroute.py
Created Mar 31, 2017 — forked from FreeTymeKiyan/reroute.py
An example python script to reroute unassigned shards to NODE_NAME node thus recovering from the red cluster status
View reroute.py
# example python script
# pip install requests before using requests
import requests
import json
HOSTNAME="your.elasticsearch.host.com" # hostname
PORT=9200 # port number
NODE_NAME="node001" # node to reroute to
@shamil
shamil / tftp_fedora.md
Created Feb 24, 2017
TFTP server on Fedora
View tftp_fedora.md

Source

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
View setup-franz-ubuntu.sh
#!/bin/bash
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;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
@shamil
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 (
"encoding/base64"
"encoding/json"
"flag"
"fmt"
"net/url"
"os"
"os/user"
@shamil
shamil / gdb_stacktrace.md
Created Aug 27, 2015
Viewing stacktrace of running process using GDB
View gdb_stacktrace.md

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 <PID>    
View zabbix_email_template.md

This is what I use in Zabbix email action

Subject (problem):

{TRIGGER.SEVERITY}/{HOST.NAME}: {ITEM.NAME}

Subject (recovery):

OK/{HOST.NAME}: {ITEM.NAME}
You can’t perform that action at this time.