Skip to content

Instantly share code, notes, and snippets.

Looking for a job

Sergey Ponomarev stokito

Looking for a job
View GitHub Profile
stokito /
Last active Aug 13, 2022 — forked from jayluxferro/
How to run OpenWrt in VirtualBox

The official doc seems too complicated OpenWrt on VirtualBox HowTo

  1. Download and install VirtualBox. On Windows add to PATH envs C:\Program Files\Oracle\VirtualBox
  2. Get an OpenWrt image openwrt-x86-64-combined-ext4.img.gz from targets/x86/64/ folder. Direct snapshot download
  3. Uncompress the image: gunzip openwrt.img.gz
  4. Convert it to native VirtualBox format:
VBoxManage convertfromraw --format VDI openwrt.img openwrt.vdi
stokito /
Last active Aug 8, 2022
git: create a single patch file with multiple commits
# last three commits
git format-patch -3 --stdout > multi_commit.patch
# all commits that are in your branch and not in master into a single patch file multi_commit.patch
git format-patch --signoff master --stdout > multi_commit.patch
# create patches in the folder ~/output/directory/ for all commits that are in your branch and not in master
git format-patch -o ~/output/directory/ --signoff master
stokito / firewall.user
Last active Aug 8, 2022 — forked from Manouchehri/
OpenWrt: Allow only CloudFlare to access HTTP 80 and HTTPS 443 ports. Use if your uhttpd is hidden behind CF. Put this file to /etc/firewall.user. NOTE: It uses HTTP to get the list of IPs because to wget via https we need to install ca-certs. This makes you vulnerable to MiTM attacks but that's ok to be protected from internet's hackers
View firewall.user
# replace the ips-v4 with ips-v6 if needed
for ip in `wget -qO-`; do
iptables -I INPUT -p tcp -m multiport --dports 80,443,8080,8443,2052,2053,2082,2083,2086,2087,2095,2096,8880 -s $ip -j ACCEPT
stokito / qr_code_compare.go
Created Aug 4, 2022
compare Golang qr code libraries
View qr_code_compare.go
package main
import (
skip2 ""
yeqown ""
stokito /
Created Jul 12, 2020
Build template-able web page and more.

Build template-able web page and more.

busybox httpd

Start the httpd in debug mode:

$ busybox httpd -f -vvv -c ./httpd.conf

See config:

$ cat httpd.conf:
View gist:19e377c872dd85ee4445eabce97fa2e8
> imdisk -h
Control program for the ImDisk Virtual Disk Driver.
For copyrights and credits, type imdisk --version
imdisk -a -t type -m mountpoint [-n] [-o opt1[,opt2 ...]] [-f|-F file]
[-s size] [-b offset] [-v partition] [-S sectorsize] [-u unit]
[-x sectors/track] [-y tracks/cylinder] [-p "format-parameters"] [-P]
imdisk -d|-D [-u unit | -m mountpoint] [-P]
imdisk -R -u unit
stokito / pages.html
Last active Jul 7, 2022 pagination with ajax call. Optionally filter with date range
View pages.html
<!DOCTYPE html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="" integrity="sha256-YvdLHPgkqJ8DVUxjjnGVlMMJtNimJ6dYkowFFvp4kKs=" crossorigin="anonymous">
<link rel="stylesheet" href="" integrity="sha256-YW7U7x59rUPZ3DWzQKbalM/9j2Cp8wapJVQPRxL4w1k=" crossorigin="anonymous">
<script src="" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="" integrity="sha256-9SEPo+fwJFpMUet/KACSwO+Z/dKMReF9q4zFhU/fT9M=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="
stokito / somehost.conf
Last active Jul 7, 2022 — forked from tomkersten/somehost.conf
Nginx config with CORS headers added and Basic Auth
View somehost.conf
server {
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/;
ssl_certificate_key /etc/letsencrypt/live/;
root /var/www/html;
access_log off;
location / {
if ($request_method = 'OPTIONS') {
stokito / date_utils.go
Created Jul 1, 2022
Start-End date parsing
View date_utils.go
func handleRequest(w http.ResponseWriter, r *http.Request) {
args := r.URL.Query()
startDateStr := args.Get("start") // &start=2021-10-15
endDateStr := args.Get("end") // &end=2021-10-15
startDate := parseDate(startDateStr, "today")
endDate := parseDate(endDateStr, "tomorrow")
func atMidnight(startDate time.Time) time.Time {
return startDate.Truncate(24 * time.Hour).In(time.UTC)
stokito / onion-gen.js
Created Jun 28, 2022 — forked from ttaubert/onion-gen.js
Generating custom .onion names with the WebCrypto API
View onion-gen.js
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at */
"use strict";
* thirty-two