Skip to content

Instantly share code, notes, and snippets.

View mvkvl's full-sized avatar

Mikhail mvkvl

  • Vladivostok, Russia
View GitHub Profile
@mvkvl
mvkvl / self-signed-ssl-mongo.sh
Created October 5, 2025 05:48 — forked from exAspArk/self-signed-ssl-mongo.sh
Self-signed SSL Certificate with OpenSSL on MacOS | MongoDB
openssl genrsa -out CAroot.key 2048
openssl req -new -key CAroot.key -out CAroot.csr # CN should be different from the certificates below
openssl req -x509 -days 1825 -key CAroot.key -in CAroot.csr -out CAroot.crt
cat CAroot.crt CAroot.key > CAroot.pem
openssl genrsa -out mongod.key 2048
openssl req -new -key mongod.key -out mongod.csr
openssl x509 -req -days 1825 -in mongod.csr -CA CAroot.pem -CAkey CAroot.key -CAcreateserial -out mongod.crt
cat mongod.crt mongod.key > mongod.pem
//
// run in development console in browser
// (source: https://webapps.stackexchange.com/questions/111680/how-to-find-channel-rss-feed-on-youtube)
//
for (var arrScripts = document.getElementsByTagName('script'), i = 0; i < arrScripts.length; i++) {
if (arrScripts[i].textContent.indexOf('externalId') != -1) {
var channelId = arrScripts[i].textContent.match(/\"externalId\"\s*\:\s*\"(.*?)\"/)[1];
var channelRss = 'https://www.youtube.com/feeds/videos.xml?channel_id=' + channelId;
var channelTitle = document.title.match(/\(?\d*\)?\s?(.*?)\s\-\sYouTube/)[1];
console.log('The rss feed of the channel \'' + channelTitle + '\' is:\n' + channelRss);
@mvkvl
mvkvl / golang-tls.md
Created July 16, 2023 12:59 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@mvkvl
mvkvl / chat.go
Created May 28, 2023 14:51 — forked from artyom/chat.go
Example of interactive terminal in Go
package main
import (
"fmt"
"io"
"log"
"os"
"golang.org/x/crypto/ssh/terminal"
)
@mvkvl
mvkvl / figlet_examples.sh
Last active May 23, 2023 00:47 — forked from LunaCodeGirl/examples.sh
Figlet how to and examples
figlet "I've got something to say"
figlet -f thick "Make Tech ASCIIer"
date | figlet -f basic
@mvkvl
mvkvl / gist:9de573e0a970ae033066038b30ca7414
Created December 14, 2022 01:11
Get docker host IP from inside container
/sbin/ip route | awk '/default/ { print $3 }'
@mvkvl
mvkvl / sudoers.md
Last active February 7, 2022 05:17
broken /etc/sudo repair

A) Replace broken sudoers file with default one (see below):

pkttyagent -p $(echo $$) | pkexec cp ~/sudoers /etc/sudoers

B) Remove broken sudoers file (in sudoers.d directory):

pkttyagent -p $(echo $$) | pkexec rm /etc/sudoers.d/FILENAME
@mvkvl
mvkvl / gist:3e37747dea60b48d6c9e62eb07a9311b
Created June 10, 2020 12:28
Reset lost grafana admin password
#
# sets password to 'admin'
#
$ sudo sqlite3 /var/lib/grafana/grafana.db
sqlite> update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin';
sqlite> .exit