Skip to content

Instantly share code, notes, and snippets.

View rbnpercy's full-sized avatar

Robin Percy rbnpercy

View GitHub Profile
import base64, times, strutils, strformat
let STR_SIZE = 131072
let TRIES = 8192
let str = strutils.repeat('a', STR_SIZE)
var str2 = base64.encode(str)
stdout.write(fmt"encode {str[..3]}... to {str2[..3]}...: ")
var t = times.epochTime()
require "json"
text = File.read("1.json")
jobj = JSON.parse(text)
coordinates = jobj["coordinates"].as_a
len = coordinates.size
x = y = z = 0
coordinates.each do |coord|
x += coord["x"].as_f
import json
let jobj = parseFile("1.json")
let coordinates = jobj["coordinates"].elems
let len = float(coordinates.len)
var x = 0.0
var y = 0.0
var z = 0.0
{
"coordinates": [
{
"x": 0.10327081810860272,
"y": 0.03247172212368832,
"z": 0.8155255437507467,
"name": "scojbq 5965",
"opts": {
"1": [
1,
require 'json'
x = []
1000000.times do
h = {
'x' => rand,
'y' => rand,
'z' => rand,
'name' => ('a'..'z').to_a.shuffle[0..5].join + ' ' + rand(10000).to_s,
@rbnpercy
rbnpercy / hi_built
Last active November 11, 2019 15:20
$ crystal build --release src/sayhi_c.cr
$ ./sayhi_c
> Hi Status!
require "./sayhi_c/*"
@[Link(ldflags: "#{__DIR__}/sayhi_c/sayhi.o")]
lib Say
fun hi(name : LibC::Char*) : Void
end
Say.hi("Status")
#include <stdio.h>
void hi(const char * name){
printf("Hi %s!\n", name);
}
<!DOCTYPE html>
<html class='has-navbar-fixed-top' >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
</head>
<body class='has-navbar-fixed-top' >
<p >Hello</p>
<p >World</p>
import html_dsl
html page:
head:
title("Title")
body:
p("Hello")
p("World")
dv:
p "Example"