Skip to content

Instantly share code, notes, and snippets.

View cuamckuu's full-sized avatar
🐭
- Explain your bigness?

Alex Kosh cuamckuu

🐭
- Explain your bigness?
View GitHub Profile
@munificent
munificent / generate.c
Last active January 27, 2025 18:14
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@halfelf
halfelf / how_to_build_a_fast_limit_order_book.md
Created February 11, 2019 02:18
How to Build a Fast Limit Order Book

https://web.archive.org/web/20110219163448/http://howtohft.wordpress.com/2011/02/15/how-to-build-a-fast-limit-order-book/

The response to my first few posts has been much larger than I’d imagined and I’d like to thank everyone for the encouragement.

If you’re interested in building a trading system I recommend first reading my previous post on general ideas to keep in mind.

My first really technical post will be on how to build a limit order book, probably the single most important component of a trading system. Because the data structure chosen to represent the limit order book will be the primary source of market information for trading models, it is important to make it both absolutely correct and extremely fast.

To give some idea of the data volumes, the Nasdaq TotalView ITCH feed, which is every event in every instrument traded on the Nasdaq, can have data rates of 20+ gigabytes/day with spikes of 3 megabytes/second or more. The individual messages average about 20 bytes each so this means handling

@CJEnright
CJEnright / gzip.go
Last active April 7, 2025 10:51
Idiomatic golang net/http gzip transparent compression, an updated version of https://gist.github.com/bryfry/09a650eb8aac0fb76c24
package main
import (
"net/http"
"compress/gzip"
"io/ioutil"
"strings"
"sync"
"io"
)
package main
import (
"encoding/json"
"fmt"
)
func main() {
b := []byte(`{"key":"value"}`)
@kizzx2
kizzx2 / docker-compose.yml
Last active April 20, 2025 21:43
Restart a docker container periodically with docker-compose
version: '3'
services:
app:
image: nginx:alpine
ports: ["80:80"]
restart: unless-stopped
restarter:
image: docker:cli
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
@tylerneylon
tylerneylon / rwlock.py
Last active January 15, 2025 00:16
A simple read-write lock implementation in Python.
# -*- coding: utf-8 -*-
""" rwlock.py
A class to implement read-write locks on top of the standard threading
library.
This is implemented with two mutexes (threading.Lock instances) as per this
wikipedia pseudocode:
https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Using_two_mutexes
@hvgab
hvgab / prettyprint_json_jinja.py
Created January 26, 2018 16:24
Add a json prettyprint filter for jinja
# prettyprint json i jinja
def ppjson(value, indent=2):
return json.dumps(value, indent=indent)
jinja2.filters.FILTERS['ppjson'] = ppjson
@bhmj
bhmj / README.md
Last active November 17, 2024 15:53
Тестовое задание по Golang + Postgresql

Задание (Golang + PostgreSQL)

Написать сервис, который будет слушать входящие запросы по HTTP, преобразовывать их в запрос к соответствующей функции Postgres, выполнять запрос и возвращать ответ клиенту.

Дописать функции Postgres для сервиса.

/Скиллы: Golang, Postgres, regexp, строки, работа с json в Golang и Postgres/

1. Web-сервис

@romanvm
romanvm / sqlite_storage.py
Last active September 22, 2022 18:33
Simple key-value storage based on SQLite
# coding: utf-8
#
# Copyright (c) 2017 Roman Miroshnychenko <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@mariocesar
mariocesar / telegram.py
Created June 13, 2017 19:52
Send a telegram message with python requests
import requests
api_url = 'https://api.telegram.org/bot{token}/{method}'.format
TELEGRAM_ACCESS_TOKEN = os.environ.get('TELEGRAM_ACCESS_TOKEN', None)
def telegram_command(name, data):
url = api_url(token=TELEGRAM_ACCESS_TOKEN, method=name)
return requests.post(url=url, json=data)