Filter by tag:
React
OSHA 30 Preparation HelperDeployed at
The purpose of this project is to assist with preparations for the OSHA 30 certification. Instead of giving the right answer, it offers choices and lets the user to try to answer correctly. Almost 1,500 questions and answers can be searched by keywords or full sentences. Some questions and answers contain alternative readings. A random question that appears initially or after emptying the search field allows for a quick knowledge test. The search routine uses flexsearch under the hood.
React
AoE2 CardDeployed at
A quick search for Age of Empires II units and civilizations. Discover their strengths and weaknesses.
JavaScript
P.F. EngineeringDeployed at (Closed Source Code)
Server-side rendered website. Collaborative project with Jacob Benison featuring searchable image galleries, pages written in Markdown (CommonMark flavor) with custom rendering addons. It also features a Cart module that accepts PayPal payments.
React
PixiJS
Parcheesi: The Board GameDeployed at
Parcheesi indie game for family and friends to play together on a single device. The game elements are oriented towards each edge of the device.
Cloudflare Workers
QR Code Compression Worker
Cloudflare worker, that converts a requested text into QR Code data array, with API for packing 3x3 modules as 9-bit numbers for low-end devices that expect a packing to reduce their CPU usage:
1 +-----+-----+-----+-----+ +-----+-----+-----+-----+ 2 |0 0 0|1 1 0|1 0 1|0 0 1| | | | | | 3 |1 1 0|1 0 1|1 0 1|0 1 1| | 24 | 235 | 365 | 308 | 4 |0 0 0|1 1 0|1 0 1|0 0 1| | | | | | 5 +-----+-----+-----+-----+ -> +-----+-----+-----+-----+ 6 |0 0 0|1 0 0|1 1 1|0 0 1| | | | | | 7 |0 0 0|1 0 1|1 1 1|0 0 1| | 0 | 233 | 511 | 292 | 8 |0 0 0|1 1 0|1 1 1|0 0 1| | | | | | 9 +-----+-----+-----+-----+ +-----+-----+-----+-----+
Bits being layed out this way:
1 +------------+ 2 |1 2 4 | 1<<0 1<<1 1<<2 3 |8 16 32 | 1<<3 1<<4 1<<5 4 |64 128 256 | 1<<6 1<<7 1<<8 5 +------------+
C#Visual Studio
Kanagawa ThemePublished to Visual Studio Marketplace
Theme for Visual Studio inspired by the colors of the famous painting by Katsushika Hokusai.
C#Windows
C# DisplayedAppSwitcherWindows tray icon utility that manages applications competing for the 2nd screen space, hiding Zoom's secondary window from the system using Win32 API when keyboard shortcut is pressed.
Tree StructuresPublished to
tree_structures is a Dart implementation of (currently only) a red-black self-balancing binary search tree in Dart with a possibility to output to Graphviz for previewing. Red-black tree solution is based on the logic and structure of the Franck Bui-Huu's C implementation.
dos2unixPublished to
Command-line utility that converts text files with \r\n line endings into \n. Gracefully interrupts upon Ctrl+C. Recognition whether a file consists of a text or not is performed using http.DetectContentType based on the algorithm described at mimesniff.
Caddy configuration injection
gRPC server that accumulates configurations to update Caddy server.
Proof of concept with minimum API.
The idea is quite simple:
  • Caddy starts with a regular conf but without routes:
    json
    1{ 2 "apps": { 3 "http": { 4 "servers": { 5 "myserver": { 6 "automatic_https": { 7 "skip": [] 8 }, 9 "listen": [ 10 ":443" 11 ], 12 "routes": [ 13 ] 14 } 15 } 16 } 17 } 18}
  • This gRPC server is started.
  • Each application uses this server by sending requests to register their routes via gRPC calls.
    gomain.go
    1package main 2 3import ( 4 "context" 5 "flag" 6 "github.com/king8fisher/caddycfginjector/lib" 7 pb "github.com/king8fisher/caddycfginjector/proto/caddycfginjector" 8 "time" 9) 10 11var ( 12 addr = flag.String("addr", "localhost:50051", "the address to connect to") 13) 14 15func main() { 16 flag.Parse() 17 fn := lib.Fn(*addr, &pb.Route{ 18 Id: "example.com", 19 Handles: []*pb.Handle{ 20 { 21 Handler: &pb.Handle_ReverseProxy{ 22 ReverseProxy: &pb.ReverseProxy{ 23 Transport: &pb.Transport{ 24 Protocol: pb.Transport_HTTP, 25 }, 26 Upstreams: []*pb.Upstream{ 27 { 28 Dial: &pb.Dial{ 29 Host: "localhost", 30 Port: uint32(8080), 31 }, 32 }, 33 }, 34 }, 35 }, 36 }, 37 }, 38 Matches: []*pb.Match{ 39 { 40 Hosts: []string{"example.com", "beta.example.com"}, 41 Paths: []string{"/*"}, 42 }, 43 }, 44 }) 45 46 t, cancel := context.WithTimeout(context.Background(), time.Second*5) 47 defer cancel() 48 go lib.Periodically(t, time.Second*2, fn) 49 <-t.Done() 50}
  • This server then notifies Caddy of a change vis Caddy API.
Go run SASS
A simple command line tool wrapper to generate css using go-libsass, which otherwise recompiles the whole library when simply imported as github.com/wellington/go-libsass.
The command line can be called either manually or as part of application rebuilding routine. It can also be run from within the go web server responsible for compiling the resulted css.
go
1ifchanged.ExecuteCommand("go-run-sass", 2 "-i", "./web/global.scss", 3 "-o", "./web/generated.css")
The example uses ifchanged to minimize the call to .scss file changes.
JSON Walk
jsonwalk.Walk walks arbitrary JSON nodes, unmarshalled with the standard library json.Unmarshall call.
gowalk_docker_inspect.go
1jsonwalk.Walk(&v, jsonwalk.Callback(func(path jsonwalk.WalkPath, key interface{}, value interface{}, tp jsonwalk.NodeValueType) { 2 if path.Path() == "[0].Config.Env" && tp == jsonwalk.Array { 3 for _, v := range value.([]interface{}) { 4 env = append(env, v.(string)) 5 } 6 } else if (path.Path() == "[0].Config.Hostname") && tp == jsonwalk.String { 7 hostName = value.(string) 8 } else if (path.Path() == "[0].Name") && tp == jsonwalk.String { 9 name = value.(string) 10 } else if (path.Path() == "[0].State.Status") && tp == jsonwalk.String { 11 status = value.(string) 12 } else if (path.Path() == "[0].Config.WorkingDir") && tp == jsonwalk.String { 13 workingDir = value.(string) 14 } else if (path.Path() == "[0].Config.Image") && tp == jsonwalk.String { 15 image = value.(string) 16 } else if strings.HasPrefix(path.Path(), "[1]") { 17 warning = "--- warning: [1] found in the array" 18 } 19}))
Splicego1.18+ generics implementation of JavaScript's array.splice function for []T where T is constrained to 'any'.
go
1func ExampleSplice() { 2 var months = []string{"Jan", "March", "April", "June"} 3 Splice(&months, 1, 0, "Feb") // inserts at index 1 4 fmt.Println(months) 5 deleted := Splice(&months, 4, 1, "May") // replaces 1 element at index 4 6 fmt.Println(months) 7 fmt.Println(deleted) 8 // Output: 9 // [Jan Feb March April June] 10 // [Jan Feb March April May] 11 // [June] 12}
FreshFresh is a command-line tool that (re)builds and (re)starts a Go application every time the source code is modified.
1$ fresh -help 2Usage of fresh: 3 -c string 4 config file path (default "./.fresh.yaml") 5 -e string 6 environment variables prefix. "RUNNER_" is a default prefix 7 -g alias for -generate 8 -generate 9 generate a sample settings file either at "./.fresh.yaml" or at specified by -c location 10 -h print help page 11 -v alias for -version 12 -version 13 print current version and exit
TerminalCollection of utilities to output to colored terminal in a unified way.
go
1var t terminal.Terminal 2t.StartAlternativeBuffer() 3w, h := t.GetSize() 4t.SetCursorVisible(false) 5t.Printf("Start (%d,%d)", w, h) 6end := fmt.Sprintf(terminal.SetBright(true)+"End (%d,%d)"+terminal.SetBright(false), w, h) 7t.MoveToY(h - 1) 8// 01234 w = 5 9// | | 10// | xx| l = 2. 5-2= 3 11t.MoveToX(w - len(end)) 12t.SavePos() 13t.Printf(end) 14time.Sleep(time.Second) 15t.RestorePos() 16t.MoveByY(-1) 17t.Printf("Nice!") 18t.MoveByX(0) 19time.Sleep(time.Second) 20t.EraseRestOfScreen()
Voronoi Diagrams in Go
An implementation of Steven J. Fortune's algorithm to efficient Voronoi diagrams computing in Go language. It is based on a Raymond Hill's JavaScript implementation, forked from an excellent work by Przemyslaw Szczepaniak at github.com/pzsz/voronoi.
gomain.go
1import "github.com/zzwx/voronoi" 2 3func useVoronoi() { 4 // Sites of voronoi diagram 5 sites := []voronoi.Vertex{ 6 voronoi.Vertex{4, 5}, 7 voronoi.Vertex{6, 5}, 8 //... 9 } 10 11 // Create bounding box 12 bbox := NewBBox(0, 0, 20, 10) 13 14 // Compute diagram and close cells (add half edges from bounding box) 15 diagram := NewVoronoi().Compute(sites, bbox, true) 16 17 // Iterate over cells & their halfedges 18 for _, cell := diagram.Cells { 19 for _, hedge := cell.Halfedges { 20 //... 21 } 22 } 23 24 // Iterate over all edges 25 for _, edge := diagram.Edge { 26 //... 27 } 28}
Interval
Utility for normalizing a numeric range, with a wrapping function useful for polar coordinates. It's exploring go 1.x code generation. It is a clone of a JavaScript project by James Talmage.
go
1func main() { 2 fmt.Println(interval.WrapInt(0, 360, 400)) //=> 40 3 fmt.Println(interval.WrapInt(0, 360, -90)) //=> 270 4 fmt.Println(interval.ClampInt(0, 100, 500)) //=> 100 5 fmt.Println(interval.ClampInt(0, 100, -20)) //=> 0 6 7 r := interval.NewRangeFloat64(0, 100, false, false) 8 fmt.Println(r.Wrap(120)) //=> 20 9 fmt.Println(r.Validate(120)) //=> 0, error(120 is outside of range [0,100]) 10 fmt.Println(r.Test(120)) //=> false 11 fmt.Println(r) //=> [0,100] (uses Stringer interface) 12}
Ifchanged
Package ifchanged is a collection of Go functions to perform callbacks in case of file changes (using sha256 hash) and / or missing files.
go
1err = ifchanged.NewIf(). 2 Changed(fileName, fileName+".sha256"). 3 Missing("somefile.txt"). 4 Execute(func() error { 5 fmt.Printf("This has been called because \"somefile.txt\" is missing or %v has changed\n", fileName) 6 return nil 7 })
Iffound
A simple go library to chain reading of a file if it is found.
Current
An attempt to make modules with resource files act as if they are embedded instead of actually embedding resources. Works in environments when it's known that the module will be built from source.
A module uses current.NewPath() to declare a variable or simply current.Path as an embedded type to make .Join(...) method work from the physical location on the drive of the .go source file even when it becomes a downloaded module. The .Path() method returns the exact position of the .go file on the drive.
The returned paths are always absolute.
Gamut Mask
Gamut mask tools implemented in Go. Can be used either as executable or as a library.
OpenStreetMap Map Tiles
OSM tiles tools and webapp. The purpose:
  • Arranging OpenStreetMap Map Tiles
    • The resulting tiles are suitable for printing
    • Producing a big PNG-file made of tiles
l10nPHP
Localization of e107 CMSPublished to
Automation of PHP source code changes of e107 Content Management System. Translation of the admin page entries into Russian, maintaining of the localization web-site as well as testing localization for completeness between 2008 and 2009.
l10n
SparkLab's Viscosity LocalizationImproved localization of SparkLab's Viscosity application.
On-premises ERP
Design and coding of an on-premises ERP, running on top of Oracle Database.

Stack

  • Oracle RDBMS
    • PL/SQL for business logic
  • Oracle Forms for GUI

Unique features

  • Full text search with fault tolerance.
  • Browsing of hierarchy of linked entries to dig into the history of home appliances repair.
  • Printing of sophisticated forms (utilizing Microsoft Word OLE).
(Closed Source Code, 1999-2009)
JavaScriptnpm
Termi-linkPublished to
This library provides clickable terminal links for terminals that support them. It is designed to seamlessly replace popular terminal-link.

Reason

https://github.com/sindresorhus/terminal-link/issues/18 - terminal-link unfortunately adds a %E2%80%8B (Zero Width Space (ZWSP) character in Unicode, code point U+200B) to the start and end of the link in unsupported terminals, which makes links lead to 404 at least on Windows.
JavaScriptnpm
Precise ColorsPublished to
This library converts colors between various models without performing any rounding.
The idea is that if a non-trivial conversion is needed, you would perform a sequence of conversions and apply rounding only at the very end, minimizing mathematical errors along the way.
ts
1import { 2 hsl2hsv, 3 hsv2rgb, 4 Rgb, 5 rgb2hsl, 6} from "precise-colors"; 7 8const rgb: Rgb = { r: 100, g: 150, b: 255 }; 9const hsl = rgb2hsl(rgb); 10const hsv = hsl2hsv(hsl); 11const back = hsv2rgb(hsv);
Dictionary ExplorerEnglish dictionary explorer. Parses and validates WordNet XML dictionary using Zod and prepares data for the work-in-progress web application.

Zod Test Coverage

1📂 LexicalResource [-] (basic test for a parent) 2 📂 Lexicon [-] (basic test for a parent) 3 📂 LexicalEntry [x] 4 📄 Form [x] 5 📂 Lemma [x] 6 📄 Pronunciation [x] 7 📂 Sense [x] 8 📄 SenseRelation [x] 9 📂 Synset [x] 10 📄 Definition [x] 11 📄 Example [x] 12 📄 ILIDefinition [x] 13 📄 SynsetRelation [x] 14 📄 SyntacticBehaviour [x]
xslt
Godot Doc XSLT TransformationGodot doc XSLT transformation.
av
Anton VeretennikovPersonal Landing Page