Skip to content

Instantly share code, notes, and snippets.

View kwando's full-sized avatar
🦀

Hannes Nevalainen kwando

🦀
View GitHub Profile
@kwando
kwando / multiline-strings-report.md
Created July 30, 2026 11:17
Survey of multiline strings

Multiline Strings Across Programming Languages

A survey of how major programming languages handle multiline string literals, focusing on delimiters, whitespace trimming behavior, and design patterns.

Summary Table

Language Syntax Whitespace Trimming Trimming Strategy
Python """...""" No (preserve all) Use textwrap.dedent() manually
@kwando
kwando / Build.txt
Created November 21, 2025 21:21
Output oog ESDL
❯ make
Downloading esdl2...
curl -LO https://github.com/ninenines/esdl2/archive/refs/heads/master.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 531970 0 531970 0 0 974145 0 --:--:-- --:--:-- --:--:-- 974145
unzip master.zip
Archive: master.zip
c1eeb85e7256e3fc9ee95a4093ae85bd8ca62710
@kwando
kwando / example.md
Created August 22, 2024 10:22
DuckDB example

Start a shell duckdb

-- creates a new in memory table for your data
create table mydata as select * from 'myfile.csv';

-- do SQL stuff to your data
update mydata set name = 'foo' where name = 'bar';

copy (from mydata) to 'myfile_updated.csv';
@kwando
kwando / ecto_schema.livemd
Created September 14, 2022 09:00
Ecto param schemas [livebook]

Ecto Schema

Mix.install([:ecto])

Section

defmodule ParamSchema do
@kwando
kwando / param_schema.ex
Created October 25, 2020 09:03
ParamSchema
defmodule ParamSchema do
defmodule ValidationHelpers do
def validate_subset1(changeset, key, values) do
Ecto.Changeset.get_field(changeset, key)
|> case do
nil -> changeset
selected_values ->
Enum.split_with(selected_values, &Enum.member?(values, &1))
|> IO.inspect(label: "hello")
@kwando
kwando / certcheck.rb
Created January 29, 2020 14:50
Check certificate expiration
#!/usr/bin/env ruby
require 'date'
require 'time'
domain = ARGV[0]
if !domain
STDERR.puts "no domain given"
exit(-1)
end
@kwando
kwando / repo.rb
Created February 13, 2017 14:34
Custom read type ruby repo
require 'bundler'
Bundler.setup
require 'sequel'
DB = Sequel.connect('sqlite::memory')
DB.create_table(:users) do
primary_key(:id)
String :name, null: false
require 'bundler'
Bundler.setup
require 'sequel'
DB = Sequel.connect('sqlite::memory')
DB.create_table(:users) do
primary_key(:id)
String :name, null: false
@kwando
kwando / schema.rb
Last active April 19, 2016 08:07
Schema support for your adapter
require 'dry/types'
module ROM
module Plugins
module Relation
module Schema
Undefined = Object.new.freeze
def self.included(klass)
super
@kwando
kwando / jruby 9.0.4.0
Created January 12, 2016 12:43
dry-v benchmarks
user system total real
DV: 1 thread 0.830000 0.020000 0.850000 ( 0.761257)
AM: 1 thread 5.880000 0.160000 6.040000 ( 5.992480)
DV: 2 threads 0.750000 0.010000 0.760000 ( 0.374995)
AM: 2 threads 5.370000 0.080000 5.450000 ( 2.780504)
Calculating -------------------------------------
DV: 1 thread 1.000 i/100ms
AM: 1 thread 1.000 i/100ms