Skip to content

Instantly share code, notes, and snippets.

View henno's full-sized avatar

Henno Täht henno

View GitHub Profile
const express = require('express');
const fs = require("fs");
const readline = require("readline");
const app = express();
const port = 3003;
let ip;
let userName;
// Process JSON in request body
app.use(express.json());

:put [/ip cloud get public-address]

@henno
henno / How_to_create_or_renew_a_Namecheap_SSL_certificate_for_Mikrotik_SSTP_VPN.MD
Last active January 19, 2022 08:11
How to create or renew a Namecheap SSL certificate for Mikrotik SSTP VPN
  1. In Namecheap, Open Account > SSL Certificates from the navbar.
  2. Pres RENEW, REISSUE or ACTIVATE depending on which button you see and get to the point where it asks for CSR
  3. Go to https://decoder.link/csr_generator to generate a CSR.
  4. Copy text from the CSR and PRIVATE KEY somewhere safe.
  5. Go back to Namecheap and paste the CSR to the CSR box. The domain name should be read from the CSR.
  6. Next, for the DCV method, choose whatever you wish to use to validate that you have control over the domain and pass the validation process.
  7. After validation you can download the certificate files as a zip file from the SSL details page.
  8. Extract the certificate files from the zip file.
  9. Create a new empty text file with the same name as the .crt in the zip but with .key extension (DOMAIN_NAME.key).
  10. Paste the PRIVATE KEY text into the text file and save it.
@henno
henno / diff.patch
Created October 22, 2021 12:16
Create and verify signatures for barBank
Index: crypto.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/crypto.js b/crypto.js
new file mode 100644
--- /dev/null (date 1634904787281)
+++ b/crypto.js (date 1634904787281)
@@ -0,0 +1,58 @@
@henno
henno / test.js
Created October 22, 2021 11:00
node-jose sign and verify
const {JWK, JWS} = require('node-jose')
const fs = require('fs')
const {join} = require('path')
const jwkToPem = require('jwk-to-pem')
const jwt = require('jsonwebtoken')
const certDir = '.cert'
const keystoreFile = join(certDir, 'keystore.json')
Windows terminal
Kuidas PHPs koodi siluda [Xdebug]
Kuidas Vim editoris teksti asendada
Kuidas SSHga faile kopeerida arvutite vahel [scp]
Kuidas varem kopeeritud tekste taaskasutada uuesti kopeerimata (ditto)
MySQL andmebaasist tõmmisfaili loomine (mysqldump)
MySQLis tulemi kuvamine ridade asemel CSV loendina (GROUP_CONCAT)
Kuidas PHPs massiivi teisendada sõneks (implode) ja vastupidi (explode). PHP massivist viimase liikme eemaldamine (array_pop)
Kuidas PHPga MySQL päringuid luua ja tulemit vormindada HTML-iks
Kuidas MySQLis ainult erinevaid kasutatud väärtuseid saada (DISTINCT)
@henno
henno / getLiveMySqlDbToDev.sh
Created February 12, 2021 14:09
getLiveMySqlDbToDev.sh
ssh -C [email protected] "mysqldump -u myLiveUser -pMyLivePass myLiveDb --no-tablespaces" | mysql -u myLocalUser -pMyLocalPass myLocalDb
# -C use compression
@henno
henno / refresh_mongodb.sh
Last active December 4, 2020 12:13
refresh_mongodb.sh
#!/bin/bash
# Dumps the database specified in a MONGO_URL variable in the .env file to dump folder in the current directory
# Restores collections from dump folder in current directory to a database specified in a MONGO_URL variable in the .env file
# Usage: refresh_mongodb.sh [--dump]
#
# Get connection string from .env
export $(cat .env | sed 's/#.*//g' | xargs)
echo $MONGO_URL
@henno
henno / Letencrypt for IIS and SSTP
Last active November 25, 2020 14:15
How to set up Letsencrypt certificate on Windows server for IIS and SSTP VPN at the same time
./wacs --target iissite --siteid 1 --validation selfhosting --installation "iis,script" --script "C:/letsencrypt/Scripts/PSScript.bat" --scriptparameters "C:/letsencrypt/Scripts/ImportSSTP.ps1 {5} 1"
Type a message
@henno
henno / xml
Created November 23, 2020 09:04
Office Standard 2019 configuration for Office Deployment Tool
<Configuration ID="e1eb0c63-77fb-499f-8959-3510f701a383">
<Add OfficeClientEdition="64" Channel="PerpetualVL2019">
<Product ID="Standard2019Volume" PIDKEY="6NWWJ-YQWMR-QKGCB-6TMB3-9D9HK">
<Language ID="et-ee" />
<Language ID="en-us" />
<ExcludeApp ID="Groove" />
<ExcludeApp ID="OneNote" />
<ExcludeApp ID="Publisher" />
</Product>
<Product ID="LanguagePack">