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
@niksaak
niksaak / 18.lisp
Last active December 14, 2015 07:38
python is not required
(declaim
(optimize (compilation-speed 0) (debug 0) (safety 0) (space 0) (speed 3)))
(defvar *triangle*
'((75)
(95 64)
(17 47 82)
(18 35 87 10)
(20 04 82 47 65)
(19 01 23 75 03 34)
(defvar *triangle-path* #p"67-triangle.txt")
(defvar *memoization-table* (make-hash-table :test 'equalp))
(defun parse-integers-list (line &optional (start 0))
"given string with whitespace separated integers return list of them"
(when line
(multiple-value-bind (integer index)
(parse-integer line :start start :junk-allowed t)
(when integer
(cons integer (parse-integers-list line index))))))
/* Example usage of internal api */
#include <aie_arc.h>
typedef struct Header {
char magic[4];
uint32_t fcount;
uint64_t dummy;
} Header;
-- Concatenate contents of strings1 with strings2 and the rest.
-- Return flat table of all possible concatenations.
local function Affixate(strings1, strings2, ...)
strings1 = MakeFlatTable(strings1)
if not strings2 then
return strings1
end
strings2 = MakeFlatTable(strings2)
local result = {}
package main
import "flag"
import "fmt"
import "os"
var oz = flag.Bool("oz", false, "if false, write 55h, otherwise write AAh.")
var len = flag.Uint("len", 512, "length of the bytes buffer")
func main() {
set nocompatible
set background=dark
set rtp+=~/vimfiles/bundle/vundle
let path='~/vimfiles/bundle'
call vundle#rc(path)
Plugin 'gmarik/vundle'
Plugin 'altercation/vim-colors-solarized'
func (s *Space) evaluateK(dt float64, k int) {
q := NewQuad(BB{vect.V{-1, 1}, vect.V{1, -1}})
q.insertSlice(s.bnParticles[k])
for i := range s.bnParticles[k] {
p := &s.bnParticles[k][i]
p.position = p.position.Add(s.bnParticles[k-1][i].velocity)
p.velocity = p.velocity.Sub(p.treeForce(q).Mul(dt))
p.mass = s.bnParticles[k-1][i].mass
}
}
--- PASS: TestQuadTreeBuilding (0.00 seconds)
bnticles_test.go:55: created particle @{0.10466028797961957 0.44050908804501243}; ->{0 0}; m: 1
bnticles_test.go:55: created particle @{0.16456005321849043 -0.062285812813019814}; ->{0 0}; m: 1
bnticles_test.go:55: created particle @{-0.07536250292873431 0.18682307286710942}; ->{0 0}; m: 1
bnticles_test.go:55: created particle @{-0.4343629807825238 -0.34348074526720873}; ->{0 0}; m: 1
bnticles_test.go:55: created particle @{-0.4030304810855154 -0.19908813941471293}; ->{0 0}; m: 1
bnticles_test.go:55: created particle @{0.015212628502065395 0.31363996099009683}; ->{0 0}; m: 1
bnticles_test.go:55: created particle @{-0.2857361274176251 -0.119342810700314}; ->{0 0}; m: 1
bnticles_test.go:55: created particle @{-0.18194182566967015 -0.031110155097576808}; ->{0 0}; m: 1
bnticles_test.go:57:
const char* vertShader = R"(
#version 150
uniform mat4 project;
uniform mat4 modelview;
in float x;
in float y;
in float z;
void main() {
gl_Position = project * modelview * vec4(x, y, z, 1.0);
#define CALL_POINTER(pointer, default_val, ...) ((pointer) != NULL) ? (pointer)(__VA_ARGS_) : (default_val)