Skip to content

Instantly share code, notes, and snippets.

@kai-qu
kai-qu / energy.js
Last active July 9, 2020 15:29
generated energy for `runpenrose set-theory-domain/tree.sub set-theory-domain/venn-small.sty set-theory-domain/setTheory.dsl`
(function anonymous(x98,x109,x115,x339,x342,x385,x396,x399,x442,x3,x87,x374,x431,x8,x92,x379,x436,x2,x88,x357,x414,x7,x93,x362,x419,x134,x145,x151,x338,x349,x386,x453,x456,x499,x510,x513,x556,x15,x123,x358,x375,x488,x545,x20,x128,x363,x380,x493,x550,x14,x124,x471,x528,x19,x129,x476,x533,x170,x181,x187,x395,x406,x443,x567,x570,x613,x624,x627,x670,x27,x159,x415,x432,x602,x659,x32,x164,x420,x437,x607,x664,x26,x160,x585,x642,x31,x165,x590,x647,x206,x217,x223,x452,x463,x500,x39,x195,x472,x489,x44,x200,x477,x494,x38,x196,x43,x201,x242,x253,x259,x509,x520,x557,x51,x231,x529,x546,x56,x236,x534,x551,x50,x232,x55,x237,x278,x289,x295,x566,x577,x614,x63,x267,x586,x603,x68,x272,x591,x608,x62,x268,x67,x273,x314,x325,x331,x623,x634,x671,x75,x303,x643,x660,x80,x308,x648,x665,x74,x304,x79,x309
) {
const x0 = 0;
const x1 = 0;
const x4 = x2 - x3;
const x5 = Math.pow(x4, 2);
const x6 = x1 + x5;
const x9 = x7 - x8;
const x10 = Math.pow(x9, 2);
const x11 = x6 + x10;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"data": {
"values" : [
{"xOffset" : -6, "yOffset" : -10, "loss" : 24.922490927655154},
{"xOffset" : 1, "yOffset" : -10, "loss" : 0.060472122313392},
{"xOffset" : 6, "yOffset" : -10, "loss" : 25.535235442853004},
{"xOffset" : -6, "yOffset" : 1, "loss" : 20},
{"xOffset" : 1, "yOffset" : 1, "loss" : 7},
{
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"data": {
"values" : [
{"xOffset" : -10, "loss" : 33.824211451108546},
{"xOffset" : -8, "loss" : 26.772378229567103},
{"xOffset" : -6, "loss" : 24.922490927655154},
{"xOffset" : -4, "loss" : 23.67161420486857},
{"xOffset" : -2, "loss" : 12.575734248403776},
{"xOffset" : 0, "loss" : 11.005532738365355},
@kai-qu
kai-qu / sanitize.sh
Last active March 27, 2019 15:36
Please run the script on a copy of your history and not the actual history file. This script only works on bash history. See usage instructions below. (code by Gaurav Manek)
#!/usr/bin/bash
while IFS='' read -r line || [[ -n "$line" ]]; do
IFS=' =' read -r -a array <<< "$line"
for index in "${!array[@]}"
do
if [ $index -eq 0 ] || [[ "${array[index]:0:1}" == "-" ]]; then
printf "%s\t" "${array[index]} "
else
printf "%s\t" $(echo "${array[index]}" | md5sum | cut -c-32)
@kai-qu
kai-qu / grad.hs
Created August 21, 2018 18:12
Command: `stack ghc grad.hs -- -Wtype-defaults`
{-# LANGUAGE AllowAmbiguousTypes, RankNTypes, NoMonomorphismRestriction, ConstraintKinds #-}
-- Minimal AD example with polymorphism.
import Numeric.AD
type Autofloat a = (RealFloat a, Floating a, Real a, Show a, Ord a)
f :: (Autofloat a) => [a] -> a
f [x, y] = x^2 + y^2 + 0.1
@kai-qu
kai-qu / grad.hs
Created August 21, 2018 18:11
Command: `stack ghc grad.hs -- -Wtype-defaults`
{-# LANGUAGE AllowAmbiguousTypes, RankNTypes, NoMonomorphismRestriction, ConstraintKinds #-}
-- Minimal AD example with polymorphism.
import Numeric.AD
type Autofloat a = (RealFloat a, Floating a, Real a, Show a, Ord a)
f :: (Autofloat a) => [a] -> a
f [x, y] = x^2 + y^2 + 0.1
@kai-qu
kai-qu / typedefaults.hs
Created August 21, 2018 17:43
Command: on branch `new-style-fast`, run `stack build --profile --ghc-options -Wtype-defaults`
penrose-0.1.0.2: configure (exe)
Configuring penrose-0.1.0.2...
penrose-0.1.0.2: build (exe)
Preprocessing executable 'penrose' for penrose-0.1.0.2...
[ 5 of 16] Compiling ShapeDef ( src/ShapeDef.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/penrose/penrose-tmp/ShapeDef.p_o )
/Users/katherineye/Desktop/Code/penrose/src/ShapeDef.hs:529:58: warning: [-Wtype-defaults]
• Defaulting the following constraints to type ‘Double’
(RealFloat a0)
arising from a use of ‘findDef’ at src/ShapeDef.hs:529:58-74