Skip to content

Instantly share code, notes, and snippets.

View stokito's full-sized avatar
Self-hosting become easier 🤗

Sergey Ponomarev stokito

Self-hosting become easier 🤗
View GitHub Profile
@stokito
stokito / extract_apk.sh
Created August 16, 2023 12:59
Extract/Untar files from Alpine APK file.
# 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
# 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
<!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 February 15, 2025 11:08
CGI shell scripts samples

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
@stokito
stokito / resume.json
Last active September 4, 2023 06:29
resume.json
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Sergey Ponomarev",
"label": "Software Engineer with a focus on code quality, security, and performance",
"image": "https://secure.gravatar.com/avatar/e3bdb475309371501559e52b4e6dcc88?s=330",
"email": "[email protected]",
"url": "https://stokito.com/",
"summary": "Hi and nice to meet You here :)\nI'm an experienced Backend Developer specialized in Golang, Java and Spring.\nHave a focus on code quality, security and performance\n\n• 15+ years in Software Development using Agile. 10+ years of working with RDBMS, 8+Java, 2+ Golang\n• Clean Code, OOP, SOLID, Architecture and Design Patterns, UML, Data structures & Algorithms.\n• Web development using Node.js, HTML5, CSS, Bootstrap, JavaScript, React.JS, Gulp, Webpack.\n• API design using REST, OpenAPI, SOAP, gRPC, WebSockets. Secure Coding, OWASP, OAuth, Keycloak.\n• Databases: MySQL, PostgreSQL, MSSQL, Hibernate, JPA, Liqu
@stokito
stokito / .bash_aliases
Last active April 4, 2023 06:39
Ubuntu command line tools to make life easier
alias ll='ls -alF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
@stokito
stokito / README.md
Last active March 31, 2025 18:07
WebDAV User Script for Violentmonkey, Tampermonkey and Greasemonkey

WebDAV User Script for Tampermonkey, Greasemonkey and Violentmonkey

Browse a URL as a WebDAV share. With the Tampermonkey extension on Firefox Mobile you can use it from phone.

screenshot

Open WebDAV folder in a browser and you'll have ether 403 error or just a plain directory listing.
Then click on the addon button and it will make a file manager from the folder where you can watch, upload, delete files and direcotries.

The script automatically enables for any url that have /dav/ e.g. http://example.com/dav/ prefix or dav. subdomaain e.g. http://dav.example.com/.

@stokito
stokito / webdav_curl.md
Last active January 4, 2025 17:04
WebDAV with curl or wget for scripts and command line
@stokito
stokito / prometheus.conf
Last active February 27, 2023 23:52
Prometheus CORS workaround: Use Nginx proxy behind and set CORS header with it
# See https://github.com/prometheus/exporter-toolkit/issues/71
# Make prometheus working on localhost only and to set properly Access-Control-Allow-Origin
# Edit /etc/default/prometheus and
# add --web.listen-address=127.0.0.1:9090
# add --web.cors.origin=\"https.*\"
# The regexp looks ugly because just simple .* will result in Access-Control-Allow-Origin: *
# Then install the Nginx
# sudo apt install nginx
# put the file into /etc/nginx/sites-available/prometheus
# sudo rm /etc/nginx/sites-enabled/default
@stokito
stokito / postgresql-users.sql
Last active February 28, 2023 09:37
PostgreSQL: Setup separate users for application, all permissions for DBA and select only BA
-- The postgres user can create users and grant permissions
-- Change the default postgres user password
ALTER USER postgres PASSWORD '<new-password>';
-- The dba use it for developers or database administrator (DBA)
-- Access is given only to appdb DB.
-- For administering other dbs or users use postgres user
CREATE USER dba WITH PASSWORD '<new-password>';
GRANT ALL PRIVILEGES ON DATABASE appdb TO dba;
GRANT ALL PRIVILEGES ON SCHEMA app TO dba;