Skip to content

Instantly share code, notes, and snippets.

View eduardoleon's full-sized avatar

eduardoleon

View GitHub Profile
@eduardoleon
eduardoleon / flex.py
Last active March 14, 2024 13:39
M9 flexing
#!/usr/bin/python
import os
import subprocess
import sys
ssdir = os.path.expanduser('~/arknights/ss')
m9dir = os.path.expanduser('~/arknights/m9')
p6dir = os.path.expanduser('~/arknights/p6')
def extract(sourcedir, targetdir, crop):
pozy% math
Mathematica 13.2.0 Kernel for Linux x86 (64-bit)
Copyright 1988-2022 Wolfram Research, Inc.
In[1]:= A = {{a1,a2},{a3,a4}}
Out[1]= {{a1, a2}, {a3, a4}}
In[2]:= B = {{b1,b2},{b3,b4}}
@eduardoleon
eduardoleon / PatMat.hs
Created December 17, 2014 11:02
Pattern matching vs. Visitor pattern
import Control.Applicative
data Person = Boy String
| Girl String
data Animal = Dog String
| Cat String
| Bug
boy (Dog n) = " plays with " ++ n
@eduardoleon
eduardoleon / session
Last active May 2, 2021 07:04
session
pyon% sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24 │
│ Using Python 3.9.4. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: P.<x,y,z,w> = PolynomialRing(CC)
sage: d = 4
sage: I = Ideal([w*y^d - x*x^d, w*z^d - y*x^d])
sage: J = Ideal([w*y^d - x*x^d, w*z^d - y*x^d, w*w^d - z*x^d])
sage: p = I.hilbert_polynomial()
@eduardoleon
eduardoleon / unoffice.py
Created May 3, 2020 05:12
This is crude, but it will do for now.
#!/usr/bin/python
import os
import subprocess
import sys
def extract_media(path):
args = ['unzip', path, '*media*']
subprocess.run(args)
def list_media(path):
@eduardoleon
eduardoleon / poly
Created February 6, 2020 17:10
Differences between ML and Lisp
pyon% poly
Poly/ML 5.8 Release
> datatype foo = Foo;
datatype foo = Foo
> val mine = Foo;
val mine = Foo: foo
> datatype foo = Foo;
datatype foo = Foo
> val yours = Foo;
val yours = Foo: foo
#include <stdio.h>
#include <stdlib.h>
struct tree {
int value;
struct tree *left;
struct tree *right;
};
struct stack {
#include <stdio.h>
#include <stdlib.h>
struct stack {
int state;
void *current;
struct stack *next;
};
struct graph {
#include <stdio.h>
#include <stdlib.h>
struct tree {
struct tree *left;
struct tree *right;
};
struct stack {
int state;
#include <stdio.h>
#include <stdlib.h>
struct tree {
int value;
struct tree *left;
struct tree *right;
};
struct stack {