Skip to content

Instantly share code, notes, and snippets.

View stokito's full-sized avatar
🚀
Looking for a job

Sergey Ponomarev stokito

🚀
Looking for a job
View GitHub Profile
@stokito
stokito / dnsapi.mjs
Last active November 19, 2023 10:32
acmish-dnsapi: Parse structural info. License 0BSD
View dnsapi.mjs
export function parseDnsApiInfoFile(infoFileText) {
let infoTexts = infoFileText.split('\n\n')
let infos = []
for (let infoText of infoTexts) {
let info = parseDnsApiInfo(infoText)
if (info) {
infos.push(info)
}
}
return infos
@stokito
stokito / README.md
Last active October 26, 2023 07:51
Fix problem: Ubuntu can't open any website
View README.md

My laptop batery discharged while I slept and look like my file system was broken. Or maybe I run an update and forgot. Anyway, after reboot I still had a problem: no any website was opening with some weird error that DNS can't be resolved.

And yes, the ping doesn't worked for any domain. Dig was failed too. It turned out that systemd-resolvd DNS daemon didn't started. I checked logs with

journalctl -u systemd-resolved

In logs I found that the resolved fails with an error "cannot allocate memory".and after that the servive crashed.

@stokito
stokito / README.md
Last active November 22, 2023 20:42
Cryptography GUI tools: OpenSSL GUI, keys management, PKI, PGP/GPG GUI
View README.md

OS tools and user friendly cryptography GUI tools

Windows Certificate Manager Tool (certmgr.msc) Manage storage for x509 keys. No support for PGP/GPG. Can't sign or encode, can't generate a key. You can use IIS webserver managemnt console to generate a cert.Proprietary

certmgr screenshot

GNOME Seahorse GUI for SSH keys, X509 certs, PGP/GPG. Linux only.

@stokito
stokito / login.html
Created September 27, 2023 07:29
HTML5 login form Bootstrap and JavaScript
View login.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous"/>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<title>Login to admin panel</title>
@stokito
stokito / install-openjdk8-musl.sh
Last active August 21, 2023 06:43 — forked from simonswine/install-openjdk8-musl.sh
Install Java openjdk8 compiled for musl from Alpine onto OpenWRT (armv7). Tested on Turris Omnia (TurrisOS 6.4.1)
View install-openjdk8-musl.sh
#!/bin/sh
# aarch64, armhf, armv7, ppc64le, s390x, x86, x86_64
ARCH="armv7" # Turris Omnia
REVISION="8.275.01-r0"
DESTDIR="" # empty for root, you can set to /opt
# Alpine v3.13 switched to musl v1.2.0 while TurrisOS 6.4.1 uses older musl v1.1.24
# Use ldd command to see a musl version.
# If it's newer then change the URL to https://dl-cdn.alpinelinux.org/alpine/edge/
# You will also need to change the REVISION for the latest
@stokito
stokito / extract_apk.sh
Created August 16, 2023 12:59
Extract/Untar files from Alpine APK file.
View extract_apk.sh
# The Alpine package apk file is just a tar.gz file with additional files
# https://wiki.alpinelinux.org/wiki/Apk_spec
# untar into /tmp/ folder without the .PKGINFO and .SIGN.RSA file
tar -xzf openjdk8-jre.apk -C /tmp/ --exclude=.PKGINFO --exclude=.SIGN*
@stokito
stokito / cert-gen.sh
Last active October 26, 2023 07:55
Generate self signed cert with ECC elyptic curve and wildcard domain
View cert-gen.sh
# You can use smaller curve prime256v1
openssl req -x509 -new -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 -days 3650 -noenc -keyout example.com.privkey.p8 -out example.com.cer -subj "/CN=example.com" -addext "subjectAltName=DNS:example.com,DNS:*.example.com"
@stokito
stokito / webdav.html
Created May 12, 2023 21:28
Sample of WebDAV PROPFIND from JavaScript with fetch api
View webdav.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WebDAV Ajax sample</title>
<script>
let davUrl = "http://192.168.1.1/dav"
function list() {
fetch(`${davUrl}/`, {
method: 'PROPFIND',
@stokito
stokito / README.md
Last active September 7, 2023 20:59
CGI shell scripts samples
View README.md

CGI samples

CGI Variables

Standard set of Common Gateway Interface environment variable are described in RFC3875. For example:

CONTENT_TYPE=application/x-www-form-urlencoded
GATEWAY_INTERFACE=CGI/1.1
REMOTE_ADDR=192.168.1.180
QUERY_STRING=Zbr=1234567&SrceMB=&ime=jhkjhlkh+klhlkjhlk+%A9%D0%C6%AE%C6%AE&prezime=&sektor=OP
REMOTE_PORT=2292