Skip to content

Instantly share code, notes, and snippets.

View niksaak's full-sized avatar
⛑️
I CAN'T REPAIR THIS M3 TACTICAL HELMET, SIR

Mikola Samardak niksaak

⛑️
I CAN'T REPAIR THIS M3 TACTICAL HELMET, SIR
View GitHub Profile
(21:55:30) WindowsBunnyIsTheFuzziest: durka42: Of course it isn't my fault
(21:55:47) WindowsBunnyIsTheFuzziest: durka42: winapi failing to build on linux is 99% of the time because your urst installation is borked
(21:55:59) WindowsBunnyIsTheFuzziest: s/urst/rust
(21:56:05) durka42: rust is the urst
(21:59:57) WindowsBunnyIsTheFuzziest: liverwurst
(22:00:40) misdreavus: Urist McCompiler cancels Build Dependency: Borked.
NAME := vm
CXX_SOURCES := $(wildcard *.cpp)
CXX_OBJECTS := $(CXX_SOURCES:.cpp=.o)
CXXFLAGS = -std=c++14
LDFLAGS = -lm
.PHONY: debug
debug: CXXFLAGS += -O0 -Wall -g -DDEBUG
debug: $(NAME)
# Base window config
set -g base-index 1
# Prefix
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Automatic window rename
set-window-option -g automatic-rename on
@niksaak
niksaak / cheryl.hs
Last active August 29, 2015 14:20
Attempt to do some logic programming in Haskell.
module Cheryl where
import Control.Monad
-- helpers
getMonth :: Date -> Month
getDay :: Date -> Day
getMonth (month, _) = month
getDay (_, day) = day
function table.clone(tab)
local clone = {}
for k, v in ipairs(tab) do
clone[k] = v
end
return clone
end
function table.map(tab, func)
local result = {}
@niksaak
niksaak / rocket.ks
Last active August 29, 2015 14:18
Autopilot script for kerbal os.
print "Launch in 5 seconds.".
wait 3.
lock steering to up + R(0, 0, -90).
lock throttle to 1.
sas on.
wait 2.
print "Launch.".
stage.
@niksaak
niksaak / IntegratorsAgain.hs
Last active August 29, 2015 14:12
RK4 integrator with customizable force function.
integrate :: Double
-> (EntMap Body -> (Entity, Body) -> Vector2)
-> EntMap Body
-> EntMap Body
integrate dt forceComputer bodies =
IntMap.intersectionWith incrementBody increment bodies
where
increment = sum' $ zipWith scale [dt/6,dt/3,dt/3,dt/6] $ scanl derive (derive IntMap.empty 0) [dt/2, dt/2, dt]
sum' = foldr1 $ IntMap.intersectionWith dAdd
scale s = IntMap.map $ dScale s
module Physics where
import qualified Data.Map.Strict as Map
import Data.Map.Strict (Map)
import Data.Vector.Class
import Data.Vector.V2
type BoundingBox = (Double, Double, Double, Double)
@niksaak
niksaak / MovingTriangle.hs
Created October 26, 2014 18:01
Moving Triangle: The Game
{-# LANGUAGE RecordWildCards #-}
module Main where
import FRP.Helm
import qualified FRP.Helm.Keyboard as Keyboard
import qualified FRP.Helm.Window as Window
import Vector hiding (rotate)
func force(p1 []float64, m1 float64, p2[]float64, mass2 float64) (fX, fY float64) {
const (
X = 0
Y = 1
)
dx := p1[X] - p2[X]
dy := p1[Y] - p2[Y]
distSq := dx*dx + dy*dy
dist := math.Sqrt(distSq)