Skip to content

Instantly share code, notes, and snippets.

View shamil's full-sized avatar
🎯
Focusing

Alex Simenduev shamil

🎯
Focusing
View GitHub Profile
@shamil
shamil / reroute.py
Last active July 7, 2021 08:24 — forked from FreeTymeKiyan/reroute.py
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
shamil / netmask_cidr.md
Last active May 26, 2021 11:52
Netmask / CIDR Translation Table

Netmask / CIDR Translation Table

Netmask             Binary                              CIDR    Notes
---------------------------------------------------------------------------
255.255.255.255     11111111.11111111.11111111.11111111 /32     1   useable
255.255.255.254     11111111.11111111.11111111.11111110 /31     0   useable
255.255.255.252     11111111.11111111.11111111.11111100 /30     2   useable
255.255.255.248     11111111.11111111.11111111.11111000 /29     6   useable
255.255.255.240     11111111.11111111.11111111.11110000 /28     14  useable

255.255.255.224 11111111.11111111.11111111.11100000 /27 30 useable

@shamil
shamil / vlc-merge.md
Last active January 28, 2021 10:18
VLC: how to merge and transcode multiple videos

Merge & Transcode

If you have more than one source files that need to be merged into a single output file, the general way is this (no transcoding is necessary if all streams match):

vlc file1.ps file2.ps file3.ps --sout "#gather:std{access=file,mux=ts,dst=all.ts}" --sout-keep

NB that whenever you use sout, your video and audio codecs must "be appropriate" for the mux you use (in this case, ps works with a ts mux, so we're ok).

If you want to write your files out to a mux that doesn't support the current audio or video encoding, or if you are wanting to join streams that do not have matching video/audio, then it is recommended to transcode as well.

@shamil
shamil / .bashrc
Last active June 22, 2020 12:42 — forked from anonymous/.bashrc
Configure OSX shell to be like Debian/Ubuntu. Requires MacPorts.
# ~/.bashrc: executed by bash(1) for non-login shells.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
-- 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 / nagios_mod-gearman_ubuntu.md
Created August 21, 2012 20:31
how to install nagios3 with mod-gearman on Ubuntu

how to install nagios3 with mod-gearman on Ubuntu

configure apt to not install sugested and recommended packages

sudo tee /etc/apt/apt.conf.d/02recommends <<END
APT::Install-Recommends "0";
APT::Install-Suggests "0";
APT::AutoRemove::RecommendsImportant false; # optional
END
@shamil
shamil / ssl_info.md
Last active December 28, 2017 13:53
Displaying a remote SSL certificate details using CLI tools

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 / setup-franz-ubuntu.sh
Created December 26, 2016 18:35 — forked from ruebenramirez/setup-franz-ubuntu.sh
setup franz on ubuntu
#!/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
@shamil
shamil / gcr-tags.go
Last active August 22, 2016 20:29 — forked from rjeczalik/gcr-tags.go
Reads a tag list for Google Container Registry for the given image.
package main
import (
"encoding/base64"
"encoding/json"
"flag"
"fmt"
"net/url"
"os"
"os/user"

Using Sublime Text for Go Development

Credits goes to Mark Wolfe.

If you're new to golang then before you start setup your workspace, firstly watch this video Writing, building, installing, and testing Go code.

Usually after installing go, I'm running the following commands to make GOPATH available for my user

mkdir -p ~/Documents/My/gocode/src/github.com/shamil