Skip to content

Instantly share code, notes, and snippets.

View mattecapu's full-sized avatar
🦄

Matteo Capucci mattecapu

🦄
View GitHub Profile
%
% MAMA package (MAth MAcros)
% a semantic package for mathematical symbols and fast latexing
%
% by Matteo Capucci <matteo.capucci@gmail.com>
%
% comment on an equation
\newcommand{\comment}[1]{\qquad\text{#1}}
name: exam simulation
source code: |
input: 'aaaabb'
blank: ' '
start state: q0
table:
q0:
'a' : {write: 'b', R: q1}
'b' : {R: rej}
' ' : {R: rej}
\newcommand{\lax}{\mathrm{lx}}
\newcommand{\oplax}{\mathrm{ox}}
\newcommand{\pseudo}{\mathrm{ps}}
\newcommand{\strong}{\mathrm{st}}
\newcommand{\costrong}{\mathrm{ct}}
\newcommand{\bistrong}{\mathrm{bt}}
\newcommand{\lMod}[1]{{#1}\textsf{-}\Mod}
\newcommand{\laxMod}[1]{{#1}\textsf{-}\lax\Mod}
\newcommand{\oplaxMod}[1]{{#1}\textsf{-}\oplax\Mod}
\newcommand{\E}{\mathcal{E}}
\newcommand{\utilities}{\mathsf{util}}
\newcommand{\coutilities}{\mathsf{coutil}}
\newcommand{\play}{\mathsf{play}}
\newcommand{\coplay}{\mathsf{coplay}}
\newcommand{\update}{\mathsf{update}}
\newcommand{\strategies}{\mathsf{strat}}
\newcommand{\moves}{\mathsf{moves}}
@mattecapu
mattecapu / equiv_of_sums.lagda
Last active June 22, 2019 11:27
Proof of equivalence for two definitions of sum.
# Proof of equivalence for two definitions of sum
\begin{code}
module equiv_of_sums where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; cong; sym)
open Eq.≡-Reasoning using (begin_; _≡⟨⟩_; _≡⟨_⟩_; _∎)
data ℕ : Set where
@mattecapu
mattecapu / c_cheatsheet.c
Last active January 18, 2017 09:04
List of commonly used idioms
// alias type to new_name
typedef type new_name;
// declare an array
int vector[SIZE];
// declare an array, size undetermined
int vector[] = { 3, 4 };
void read_str( char s[] );
// main signature
export default class Library extends React.Component {
static getFragment() {
return Lokka.getFragment(`
fragment on Library {
name
}
`);
}
render() {
@mattecapu
mattecapu / app.jsx
Last active January 11, 2017 10:13
import Library from '../components/library';
export default class App extends React.Component {
static async getInitialProps() {
return await Lokka.query(`{
libraries {
id,
...${Library.getFragment()}
}
}`);
import { Lokka } from 'lokka';
import { Transport } from 'lokka-transport-http';
import { SERVER_URL } from '../config';
/* singleton Lokka client */
export default new Lokka({
transport: new Transport(`${SERVER_URL}/graphql`)
});
{
"presets": [
"next/babel"
]
}