Skip to content

Instantly share code, notes, and snippets.

Looking for a job

Sergey Ponomarev stokito

Looking for a job
View GitHub Profile
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">
<meta charset="UTF-8">
<title>WebDAV Ajax sample</title>
let davUrl = ""
function list() {
fetch(`${davUrl}/`, {
method: 'PROPFIND',
stokito /
Last active May 15, 2023 07:59
CGI shell scripts samples

CGI samples

CGI Variables

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

stokito / resume.json
Created April 5, 2023 16:40
View resume.json
"$schema": "",
"basics": {
"name": "Sergey Ponomarev",
"label": "Software Engineer with a focus on code quality, security, and performance",
"image": "",
"email": "",
"url": "",
"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 / .bash_aliases
Last active April 4, 2023 06:39
Ubuntu command line tools to make life easier
View .bash_aliases
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 /
Last active March 28, 2023 21:16
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.


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. prefix or dav. subdomaain e.g.

stokito /
Last active March 18, 2023 22:46
WebDAV with curl for scripts and command line

Assuming the following:

  • Webdav share URL:
  • Username: user
  • Password: pass

curl options:

  • -u username:password use HTTP Basic authorization with the folowing username and password
  • -X GET send a request with GET method. You can use any other methods here.
stokito / prometheus.conf
Last active February 27, 2023 23:52
Prometheus CORS workaround: Use Nginx proxy behind and set CORS header with it
View prometheus.conf
# See
# Make prometheus working on localhost only and to set properly Access-Control-Allow-Origin
# Edit /etc/default/prometheus and
# add --web.listen-address=
# 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 / postgresql-users.sql
Last active February 28, 2023 09:37
PostgreSQL: Setup separate users for application, all permissions for DBA and select only BA
View postgresql-users.sql
-- 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>';
stokito / 99-disk.conf
Last active March 3, 2023 16:55
Lighttpd WebDAV+BasicAuth+CORS
View 99-disk.conf
server.modules += ( "mod_webdav", "mod_setenv" )
$HTTP["url"] =~ "^/dav($|/)" {
webdav.activate := "enable"
server.document-root := "/srv/disk/"
# skip basic auth check for OPTIONS method from CORS preflight request
$HTTP["request-method"] != "OPTIONS" {
auth.backend := "plain"
auth.backend.plain.userfile := "/etc/lighttpd/webdav.shadow"
auth.require := (
stokito / alertmanager.yml
Created December 7, 2022 22:39
Prometheus AlertsManager Telegram config
View alertmanager.yml
# See
group_by: ['alertname']
group_wait: 30s
group_interval: 5m
repeat_interval: 1h
receiver: "telegram"
- name: 'telegram'