Skip to content

Instantly share code, notes, and snippets.

View dnlcrl's full-sized avatar

dnlcrl

View GitHub Profile
@Haseeb-Qureshi
Haseeb-Qureshi / claude-code-harness-deep-dive.md
Created March 31, 2026 21:26
Inside the Claude Code source

Inside the Claude Code source

Anthropic's Claude Code CLI source code leaked onto GitHub recently. All of it. About 1,900 files and a lot of TypeScript.

I read through the key modules. What follows is a breakdown of the surprising parts: how the system actually works, where Anthropic made clever engineering choices, and where their approach diverges from OpenAI's Codex in ways you wouldn't guess from using either tool.

Lifecycle of a request

Here's what happens when you type a message into Claude Code:

@Haaroon
Haaroon / Rename branch from main to master
Last active August 2, 2023 21:32
Rename branch from main to master
git branch -m main master
git push -u origin master
git remote set-head origin master
# Now go to github in a browser,
# open the repo, click settings, branch and change the default branch to master
git push origin --delete main
@nileshtrivedi
nileshtrivedi / home-server.md
Last active June 1, 2024 00:11
Home Server setup: Raspberry PI on Internet via reverse SSH tunnel

Raspberry Pi on Internet via reverse SSH tunnel

HackerNews discussed this with many alternative solutions: https://news.ycombinator.com/item?id=24893615

I already have my own domain name: mydomain.com. I wanted to be able to run some webapps on my Raspberry Pi 4B running perpetually at home in headless mode (just needs 5W power and wireless internet). I wanted to be able to access these apps from public Internet. Dynamic DNS wasn't an option because my ISP blocks all incoming traffic. ngrok would work but the free plan is too restrictive.

I bought a cheap 2GB RAM, 20GB disk VM + a 25GB volume on Hetzner for about 4 EUR/month. Hetzner gave me a static IP for it. I haven't purchased a floating IP yet.

@FilippoVajana
FilippoVajana / no-mnist-data.py
Created December 10, 2019 15:51
notMNIST pytorch loader
import os
import tarfile
import imageio
import tqdm
import numpy as np
def get_nomnist():
classes = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"]
tar_path = "./data/no-mnist/archive/notMNIST_large.tar"
tmp_path = "./data/no-mnist/archive/tmp"
@normal-carrot
normal-carrot / Readme.md
Last active April 29, 2025 21:46
Docker + nginx-proxy + let's encrypt + watchtower + fail2ban

Complete solution for websites hosting

This gist contains example of how you can configure nginx reverse-proxy with autmatic container discovery, SSL certificates generation (using Let's Encrypt) and auto updates.

Features:

  • Automatically detect new containers and reconfigure nginx reverse-proxy
  • Automatically generate/update SSL certificates for all specified containers.
  • Watch for new docker images and update them.
  • Ban bots and hackers who are trying to bruteforce your website or do anything suspicious.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bogdan-kulynych
bogdan-kulynych / install-cuda-10-bionic.sh
Last active May 11, 2026 03:05
Install CUDA 10 on Ubuntu 18.04
# WARNING: These steps seem to not work anymore!
#!/bin/bash
# Purge existign CUDA first
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@dnlcrl
dnlcrl / export.py
Last active August 27, 2018 08:14
PyTorch Model Export (Python) Import (Python, C++) Snippets
import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.linear = nn.Linear(1,1)
def forward(self, x):
y = self.linear(x)
@bstriner
bstriner / lstm_speed_test.py
Last active November 10, 2020 02:09
Performance tests for Pytorch LSTMs
"""
A series of speed tests on pytorch LSTMs.
- LSTM is fastest (no surprise)
- When you have to go timestep-by-timestep, LSTMCell is faster than LSTM
- Iterating using chunks is slightly faster than __iter__ or indexing depending on setup
**Results**
My Ubuntu server:
OS: posix, pytorch version: 0.4.0a0+67bbf58
import torch
import pickle
ts = [torch.ones(10, 20) + n for n in range(4)]
diff = 0
with open('tensor.pickle', 'wb') as f:
for t in ts:
start = f.tell()
torch.save(t, f)