Skip to content

Instantly share code, notes, and snippets.

View eduardoleon's full-sized avatar

eduardoleon

View GitHub Profile
@eduardoleon
eduardoleon / m9.py
Last active February 27, 2024 00:55
M9 flexing
View m9.py
#!/usr/bin/python
import os
import subprocess
import sys
sourcedir = os.path.expanduser('~/arknights/ss')
targetdir = os.path.expanduser('~/arknights/m9')
def extract():
_, _, files = next(os.walk(sourcedir))
View gist:ff4f733590451f9e23c2c8296cba94ad
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 / session
Last active May 2, 2021 07:04
session
View 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.
View unoffice.py
#!/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
View poly
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
View balanced.c
#include <stdio.h>
#include <stdlib.h>
struct tree {
struct tree *left;
struct tree *right;
};
struct stack {
int state;
View merge.c
#include <stdio.h>
#include <stdlib.h>
struct tree {
int value;
struct tree *left;
struct tree *right;
};
struct stack {
View kosaraju.c
#include <stdio.h>
#include <stdlib.h>
struct stack {
int state;
void *current;
struct stack *next;
};
struct graph {
View paths.c
#include <stdio.h>
#include <stdlib.h>
struct tree {
int value;
struct tree *left;
struct tree *right;
};
struct stack {
View is_bst.c
#include <stdio.h>
#include <stdlib.h>
struct tree {
int value;
struct tree *left;
struct tree *right;
};
struct stack {