Skip to content

Instantly share code, notes, and snippets.

View gorshkov-leonid's full-sized avatar

Leonid Gorshkov gorshkov-leonid

View GitHub Profile
@gorshkov-leonid
gorshkov-leonid / deep_research.rb
Created February 16, 2025 20:58 — forked from schappim/deep_research.rb
A recreation of OpenAI's Deep Research feature in Ruby
#!/usr/bin/env ruby
# deep_research.rb
require 'openai'
require 'json'
require 'net/http'
require 'uri'
require 'timeout'
require 'time'

Types

  • feat Commits, that adds or remove a new feature
  • fix Commits, that fixes a bug
  • refactor Commits, that rewrite/restructure your code, however does not change any API behaviour
  • perf Commits are special refactor commits, that improve performance
  • style Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc)
  • test Commits, that add missing tests or correcting existing tests
  • docs Commits, that affect documentation only
  • build Commits, that affect build components like build tool, ci pipeline, dependencies, project version, ...
  • ops Commits, that affect operational components like infrastructure, deployment, backup, recovery, ...
@gorshkov-leonid
gorshkov-leonid / OpenAIRealtimeWebSocket.kt
Created November 19, 2024 06:28 — forked from paulotaylor/OpenAIRealtimeWebSocket.kt
Simple Kotlin OpenAI Websocket implementation of the Realtime API
import android.util.Log
import io.ktor.util.decodeBase64Bytes
import io.ktor.util.encodeBase64
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import okhttp3.WebSocket
import okhttp3.WebSocketListener
import okio.ByteString
import org.json.JSONArray
@gorshkov-leonid
gorshkov-leonid / Recipe-bundling-fonts-with-headless-chrome.md
Created February 19, 2023 15:20 — forked from nmqanh/Recipe-bundling-fonts-with-headless-chrome.md
How to build a fontconfig bundle for adding arbitrary fonts to headless chrome independent of the OS. This is specifically useful for deploying headless chrome to AWS lambda where it is necessary to include fonts for rendering CJK (Chinese, Japanese, Korean) characters into the deployed bundle.

Building fontconfig

Start up a lambda-like docker container:

docker run -i -t -v /tmp:/var/task lambci/lambda:build /bin/bash

Install some dependencies inside the container:

yum install gperf freetype-devel libxml2-devel git libtool -y

easy_install pip

@gorshkov-leonid
gorshkov-leonid / 1_simple.go
Created September 3, 2021 09:31 — forked from sosedoff/1_simple.go
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@gorshkov-leonid
gorshkov-leonid / links.md
Last active August 7, 2021 20:57 — forked from scue/shell_pack.sh
pack a shell script and its depending files as a single executable file
@gorshkov-leonid
gorshkov-leonid / downloadAttachment.js
Created June 8, 2020 21:23
Download file with content disposition attachment
function downloadFile(url) {
var loaded = $.Deferred();
var request = new XMLHttpRequest();
request.open('GET', url);
// ! setting the responseType has to be after the `request.open`
// `arraybuffer` is necessary for Internet Explorer and Edge becuase
// they do not support `blob` as response type
request.responseType = "arraybuffer";
request.onload = function() {
@gorshkov-leonid
gorshkov-leonid / xyz_vs_tms.md
Created March 17, 2017 10:12 — forked from tmcw/xyz_vs_tms.md
The difference between XYZ and TMS tiles and how to convert between them

The difference between XYZ and TMS tiles and how to convert between them

Lots of tile-based maps use either the XYZ or TMS scheme. These are the maps that have tiles ending in /0/0/0.png or something. Sometimes if it's a script, it'll look like &z=0&y=0&x=0 instead. Anyway, these are usually maps in Spherical Mercator.

Good examples are OpenStreetMap, Google Maps, MapBox, MapQuest, etc. Lots of maps.

Most of those are in XYZ. The best documentation for that is slippy map tilenames on the OSM Wiki, and Klokan's Tiles a la Google.