Skip to content

Instantly share code, notes, and snippets.

View tallakt's full-sized avatar

Tallak Tveide tallakt

View GitHub Profile
[21, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 17, 17, 17, 17, 17, 17, 17, 16, 16, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
/*
I have a 1200x600 matrix tensor in open3d c++ for reflectivity and one for azimuth.
In Open3d using the GPU, find all points where azimut crosses from negative to positive. There will be one for each row in the matrix. then select 590 reflectivity values left and right of this point but in the reflectivity matrix. These slices of reflectivity should be copied into a new matrix reflectivity_adjusted that will be 1180x600 size.
*/
#include <open3d/core/Tensor.h>
@tallakt
tallakt / 2025_08.jl
Last active December 9, 2025 23:20
aoc 2025 08
using LinearAlgebra
function day09_2025_1(; i = input_2025_09())
tiles = [parse.(Int, split(l, ",")) for l = split(i, "\n")]
area_it = ((1 + abs(x1 - x2)) * (1 + abs(y1 - y2)) for (x1, y1) = tiles, (x2, y2) = tiles)
maximum(area_it)
end
function tiles_09_2025()
[parse.(Int, split(l, ",")) for l = split(input_2025_09(), "\n")]
@tallakt
tallakt / chesscheat.jl
Last active October 8, 2022 21:53
Looking for chess cheating in centipawn dataset
using CSV
using Plots
function load_all_games()
CSV.read("/Users/tallakt/Downloads/15982_games_with_centipawn_metrics/15982_games_with_centipawn_metrics.csv", DataFrame)
end
function player_games(all_games, player_name)
@tallakt
tallakt / foilsjekte.jl
Last active July 14, 2019 21:42
Foil sjekte
using Plots
using Optim
MS_KNOTS = 1.943844
KG_LBS = 2.204623
KW_HP = 1.341022
M_FEET = 3.28084
# Dimensjoner på båten (i meter, kg etc)
# https://marex.no/wp-content/uploads/2016/12/Duckie-Catalog.pdf
#!/usr/bin/env ruby
# Reads the anemometer "Holdpeak HP-866A" from USB port
# Time stamp in unix time and windspeed in m/s is output
require 'rubyserial'
if ARGV.length != 1
$stderr.puts "usage: read_anemometer.rb <tty device>"
exit(-1)
#!/usr/bin/env ruby
require 'pty'
loop do
begin
PTY.spawn( "/usr/bin/gpspipe -w" ) do |stdout, stdin, pid|
stdout.each do |line|
m = line.match /"time":"(2...-..-..T..:..:......Z)"/
@tallakt
tallakt / init.vim
Last active January 5, 2018 08:41
init.vim
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source ~/.config/nvim/init.vim
endif
call plug#begin('~/.local/share/nvim/plugged')
Plug 'andymass/vim-matchup'
Plug 'frankier/neovim-colors-solarized-truecolor-only'
@tallakt
tallakt / mudsync.ex
Last active November 30, 2017 14:49
@doc """
# Mud Sync
Koden er basert på en modell hvor man har x pumper, hver med y stempel som går i
(360 / y) graders fase på hverandre. Man får en puls per omdreining av kamakselen. Hver
pumpe har sine egne pulser som brukes til synkronisering
"""
defmodule MudSync do
#!/bin/sh
# $ curl -s https://gist.githubusercontent.com/tallakt/7048c646b999faf17db98a49e6374324/raw/020b759c6f71d72efe67d2c7f8f7d6fcb87b8635/mining_fetch_git.sh -O mining_fetch_git.sh
cd /home/tallakt
if [ ! -e ~/mining/README.md ]; then
rm -Rf mining
git clone git@github.com:tallakt/mining.git
fi;