Skip to content

Instantly share code, notes, and snippets.

@tsukanov-as
tsukanov-as / min-char-rnn.py
Created March 4, 2023 17:26 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@tsukanov-as
tsukanov-as / gen.py
Created June 8, 2023 11:57 — forked from 45deg/gen.py
Generating Spiral Dataset for Classifying in Python
import numpy as np
from numpy import pi
# import matplotlib.pyplot as plt
N = 400
theta = np.sqrt(np.random.rand(N))*2*pi # np.linspace(0,2*pi,100)
r_a = 2*theta + pi
data_a = np.array([np.cos(theta)*r_a, np.sin(theta)*r_a]).T
x_a = data_a + np.random.randn(N,2)
@tsukanov-as
tsukanov-as / README.md
Created March 7, 2024 08:15 — forked from denji/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@tsukanov-as
tsukanov-as / nc_tricks.sh
Created November 30, 2024 17:25 — forked from tuxfight3r/nc_tricks.sh
tcp proxy with netcat and socat
#netcat proxy to a different backed and serve requests on port80
mkfifo fifo_pipe
nc -lk -p 80 < fifo_pipe | nc 192.168.1.10 3306 >fifo_pipe
#socat doing the same with connection verbosity
socat -d -d TCP-LISTEN:80,fork TCP:192.168.1.10:3306
  • What do Etcd, Consul, and Zookeeper do?
    • Service Registration:
      • Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
    • Service Discovery:
      • Ability for client application to query the central registry to learn of service location.
    • Consistent and durable general-purpose K/V store across distributed system.
      • Some solutions support this better than others.
      • Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
  • Centralized locking can be based on this K/V store.