Skip to content

Instantly share code, notes, and snippets.

View red-avtovo's full-sized avatar
⛩️
Zen

Aleksandr red-avtovo

⛩️
Zen
View GitHub Profile
@Nalorokk
Nalorokk / keenetic.php
Created April 18, 2020 06:35
Keenetic RCI API PHP
#!/bin/php
<?php
ini_set('default_socket_timeout', 15);
ini_set('display_errors', 1);
error_reporting(E_ALL);
if(keen_auth('admin', 'password')) {
$metrics = keen_request('rci/', '{"show":{"interface":{"stat":[{"name":"GigabitEthernet1"},{"name":"Wireguard0"}]}}}');
$data = $metrics[2];
@pamolloy
pamolloy / README.md
Last active October 16, 2024 20:40
Ubiquiti USG configuration for Wireguard

Download the latest ugw3 package from https://github.com/Lochnair/vyatta-wireguard/releases and install it on your USG using dpkg -i wireguard-ugw3-<version>.deb.

cd /config/auth
umask 077
mkdir wireguard
cd wireguard
wg genkey > wg_private.key
wg pubkey < wg_private.key > wg_public.key
@anvk
anvk / psql_useful_stat_queries.sql
Last active October 18, 2024 23:47
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@rangoy
rangoy / update-ros-cert.sh
Last active June 10, 2019 13:03
Crontab script for updating let's encrypt certificate on Mikrotik/RouterOS
#!/usr/bin/env bash
shopt -s expand_aliases
source "../.acme.sh/acme.sh.env"
#alias
# Based on
# Set up acme first;
# 1:
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active November 14, 2024 10:34
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@cdown
cdown / gist:1163649
Last active November 17, 2024 21:46
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in