Skip to content

Instantly share code, notes, and snippets.

/*
* # The problem
Given a number `x` and a sorted array of coins `coinset`, write a function
that finds a combination of these coins that add up to X
There are an infinite number of each coin.
This is hopefully familiar to making change for a given amount of money in a currency, but it gets more interesting if we remove the 1 coin and have “wrong” coins in the coinset.
Return a map (or dictionary or whatever it is called in your preferred programming language such that each key is the coin, and each value is the number of times you need that coin.
You need to only return a single solution, but for bonus points, return the one with the fewest number of coins.
Don’t worry about performance or scalability for this problem.
@antonvasin
antonvasin / http_streaming.md
Created July 15, 2025 15:32 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@antonvasin
antonvasin / gist:f1ba64b6a9504c652157f1681b2ae9bb
Last active April 20, 2025 13:33
vim box drawing digraphs
─ hh 2500 9472 BOX DRAWINGS LIGHT HORIZONTAL
━ HH 2501 9473 BOX DRAWINGS HEAVY HORIZONTAL
│ vv 2502 9474 BOX DRAWINGS LIGHT VERTICAL
┃ VV 2503 9475 BOX DRAWINGS HEAVY VERTICAL
┄ 3- 2504 9476 BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL
┅ 3_ 2505 9477 BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL
┆ 3! 2506 9478 BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL
┇ 3/ 2507 9479 BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL
┈ 4- 2508 9480 BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL
┉ 4_ 2509 9481 BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL
@antonvasin
antonvasin / zig-up.sh
Last active April 17, 2025 10:44
Updates zig, zls and shell-completions for macOS
#!/usr/bin/env bash
echo "Updating zig..."
latest=$(curl -sS https://ziglang.org/download/index.json | jq -r .master.version)
if command -v zig >/dev/null 2>&1 && [ "$latest" = "$(zig version)" ]; then
echo "Already have latest version of zig"
else
url=$(curl https://ziglang.org/download/index.json | jq -r '.master."aarch64-macos".tarball')
filename=$(basename $url)
@antonvasin
antonvasin / update-zig.sh
Last active August 8, 2024 11:59
Simple script to update zig and zls to latest versions
#!/usr/bin/env bash
set -e
# Define base directory for installations
BASE_DIR="$HOME/.zig"
ZLS_DIR="$BASE_DIR/zls"
ZIG_URL="https://ziglang.org/download/index.json"
ZLS_URL="https://github.com/zigtools/zls.git"
ZLS_COMMIT_FILE="$BASE_DIR/.last_zls_commit"
@antonvasin
antonvasin / index.html
Last active September 7, 2015 23:06 — forked from ZJONSSON/index.html
testing circles in Leaflet.js (working)
<!DOCTYPE html>
<html>
<head>
<title>Testing d3.js in Leaflet.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js?2.8.1"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.js"></script>
<style type="text/css">
svg , g
@antonvasin
antonvasin / slim.rb
Last active August 29, 2015 14:26
ActionMailer + slim sans Rails
# Gemfile
gem 'actionmailer', require: 'action_mailer'
gem 'slim', require: false
# boot.rb
require 'rubygems'
require 'bundler'
require 'action_view'
<?xml version="1.0"?>
<root>
<item>
<name>Remap Left Control to Hyper</name>
<appendix>OS X doesn't have a Hyper. This maps Left Control to Control + Shift + Option + Command.</appendix>
<identifier>space_cadet.left_control_to_hyper</identifier>
<autogen>
--KeyToKey--