Skip to content

Instantly share code, notes, and snippets.

View tallakt's full-sized avatar

Tallak Tveide tallakt

View GitHub Profile
@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;
#!/usr/bin/env ruby
require 'net/http'
require 'json'
def get_json(url)
uri = URI(url)
JSON.parse(Net::HTTP.get uri)
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
defmodule MatchAndAssign do
defmacro __using__(_) do
quote do
require MatchAndAssign
import MatchAndAssign, only: [match_and_assign: 2]
end
end
defp unhygienize(pattern = {n, _meta, c}) when is_atom(n) and is_atom(c) do
var! pattern