Skip to content

Instantly share code, notes, and snippets.

View narslan's full-sized avatar

Nevroz Arslan narslan

  • Turkey
  • 13:54 (UTC +03:00)
View GitHub Profile
@pesterhazy
pesterhazy / building-sync-systems.md
Last active October 2, 2025 10:40
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@dragonsinth
dragonsinth / errgroup_withcontext.go
Created February 5, 2020 03:53
Using errgroup.WithContext() in Golang server handlers
package main
import (
"context"
"encoding/json"
"fmt"
"io"
"log"
"sync/atomic"
"time"
@Saityi
Saityi / circledb.rkt
Last active December 11, 2024 11:34
'An Archaeology-inspired database' (but in Racket) (https://www.aosabook.org/en/500L/an-archaeology-inspired-database.html) (Incomplete -- does not include queries)
#lang racket
(require racket/generic
racket/match
racket/pretty
struct-update
threading)
(define flip
(curry (λ (f a b) (f b a))))
@jacksonpradolima
jacksonpradolima / install_source-pro_font.sh
Last active January 15, 2025 23:29
Installing Adobe's Source Pro fonts in Ubuntu: Source Code Pro, Source Serif Prof, and Source Sans Pro
#!/bin/bash
mkdir /tmp/adodefont
cd /tmp/adodefont
mkdir -p ~/.fonts
wget https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip
unzip 1.050R-it.zip
cp source-code-pro-2.030R-ro-1.050R-it/OTF/*.otf ~/.fonts/
wget https://github.com/adobe-fonts/source-serif-pro/archive/2.000R.zip
@melihkocaturk
melihkocaturk / gist:b56508b85157d4342444f66700953321
Last active April 30, 2022 21:08
Türkiye Şehir Listesi SQL Tablosu
CREATE TABLE `cities` (
`id` Int( 11 ) AUTO_INCREMENT NOT NULL,
`name` VarChar( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL,
PRIMARY KEY ( `id` ) )
CHARACTER SET = utf8
COLLATE = utf8_unicode_ci
ENGINE = InnoDB
AUTO_INCREMENT = 82;
INSERT INTO `cities` (`id`,`name`) VALUES ( 1,'Adana' );
@arsham
arsham / go_cpu_memory_profiling_benchmarks.sh
Last active August 15, 2025 10:10
Go cpu and memory profiling benchmarks. #golang #benchmark
go test -run=. -bench=. -benchtime=5s -count 5 -benchmem -cpuprofile=cpu.out -memprofile=mem.out -trace=trace.out ./package | tee bench.txt
go tool pprof -http :8080 cpu.out
go tool pprof -http :8081 mem.out
go tool trace trace.out
go tool pprof $FILENAME.test cpu.out
# (pprof) list <func name>
# go get -u golang.org/x/perf/cmd/benchstat
benchstat bench.txt
@eatonphil
eatonphil / server.ml
Last active April 20, 2024 10:42
A simple threaded web server in SML
(*
* Tested on PolyML. `polyc server.ml && ./a.out`
*)
fun println s =
(print (s ^ "\n"); TextIO.flushOut TextIO.stdOut)
fun readAll conn req =
let val ntoread = Socket.Ctl.getNREAD conn in
if ntoread > 0
@bryanhunter
bryanhunter / bumper.exs
Created January 20, 2015 21:18
Example of Elixir and the bit-syntax to read a Bitmap image
defmodule Bumper do
@doc ~S"""
Reads a Bitmap (24-bit) and displays width, height, and the RGB of each pixel
"""
def show(filename) do
{:ok, bindata} = File.read(filename)
<< "BM",
_::size(64),
offset_to_pixels::size(32)-little,
@staltz
staltz / introrx.md
Last active October 2, 2025 19:48
The introduction to Reactive Programming you've been missing
@mkottman
mkottman / id3.lua
Created August 22, 2011 12:13
An ID3 tag reader implemented in pure Lua. Supports ID3v1 tags and a subset of ID3v2 tags.
--- A simple module to read ID3 tags from MP3 files.
-- Supports ID3v1 tags and a (meaningful) subset of ID3v2 tags.
-- @class module
-- @name id3
-- @author Michal Kottman
-- @copyright 2011, released under MIT license
local id3 = {}
local function textFrame(name)