Skip to content

Instantly share code, notes, and snippets.

View maksadbek's full-sized avatar
💭
Chilling

maksadbek

💭
Chilling
View GitHub Profile
# This is the configuration file for Ghostty.
#
# This template file has been automatically created at the following
# path since Ghostty couldn't find any existing config files on your system:
#
# /Users/maksad/Library/Application Support/com.mitchellh.ghostty/config
#
# The template does not set any default options, since Ghostty ships
# with sensible defaults for all options. Users should only need to set
# options that they want to change from the default.
#!/usr/bin/env python3
import os
import signal
import subprocess
import sys
import time
import ffmpeg
from PyQt6.QtCore import QUrl, Qt
from PyQt6.QtMultimedia import QAudioOutput, QMediaPlayer
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>JSON Formatter • Split View</title>
<style>
:root { --left: 50%; --bg: #0f172a; --panel: #111827; --panel-2: #0b1220; --text: #e5e7eb; --muted: #94a3b8; --accent: #38bdf8; }
* { box-sizing: border-box; }
html, body { height: 100%; }
@maksadbek
maksadbek / aws-sdk-swift-sigv4.swift
Last active July 28, 2025 10:40
example code to aws-sigv4 sign custom http request with aws-sdk swift. Code doesn't compile, you should amend it a little bit
import SwiftUI
import AWSClientRuntime
import AWSSigner
import AWSSDKHTTPAuth
import Foundation
import AWSSDKIdentity
import SmithyHTTPAPI
import SmithyHTTPAuth
import Smithy
import AwsCommonRuntimeKit
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"net/http"
)
@maksadbek
maksadbek / nginx.conf
Created January 3, 2017 17:51
nginx configuration for HLS live video streaming
worker_processes 1;
error_log logs/error.log debug;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
allow play all;
sets = [[i] for i in range(len(nums))]
parent = [i for i in range(len(nums))]
def union(a, b):
set_a = parent[a]
set_b = parent[b]
if set_a == set_b:
return

Geo sharding

Shard Space

Like redis cluster, we'll use a shard space of 2^14 = 16384. Essentially what this means is that we'll take our entire geo area, and split it into 16384 segments of approximately equal entries.

Each instance will be responsible for any number of segments, typically a cluster of segments that are geographically close.

Searches

@maksadbek
maksadbek / golang-linked-list.go
Created April 27, 2016 21:43
golang linked list implementation
package main
import "fmt"
type Node struct {
prev *Node
next *Node
key interface{}
}
@maksadbek
maksadbek / modern_python_dictionaries.py
Created January 19, 2022 17:22 — forked from gerrymanoim/modern_python_dictionaries.py
Code from Modern "Python Dictionaries A confluence of a dozen great ideas - Raymond Hettinger"
import array
import collections
import itertools
# Placeholder constants
FREE = -1
DUMMY = -2
class Dict(collections.MutableMapping):
'Space efficient dictionary with fast iteration and cheap resizes.'