Skip to content

Instantly share code, notes, and snippets.

View Naereen's full-sized avatar
📝
Coder in long holidays - full time teacher

Lilian Besson Naereen

📝
Coder in long holidays - full time teacher
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jakemmarsh
jakemmarsh / binarySearchTree.py
Last active May 1, 2025 01:41
a simple implementation of a Binary Search Tree in Python
class Node:
def __init__(self, val):
self.val = val
self.leftChild = None
self.rightChild = None
def get(self):
return self.val
def set(self, val):
@jbenet
jbenet / tikz2svg
Last active November 30, 2022 04:34
tikz2svg - convert tikz input into svg
#!/usr/bin/env python
#
# author: github.com/jbenet
# license: MIT
#
# tikz2svg: convert tikz input into svg
# depends on:
# - pdflatex: comes with your tex dist
# - pdf2svg: brew install pdf2svg
(* B. C. Pierce, Types and Programming Languages. MIT Press, 2002, ch. 22, sec 7. *)
(* This progam is well typed, but demonstrates worst-case exponential time of the typechecker. *)
(* In practice, typechecking takes linear time. *)
let f0 = fun x -> (x,x) in
let f1 = fun y -> f0(f0 y) in
let f2 = fun y -> f1(f1 y) in
let f3 = fun y -> f2(f2 y) in
let f4 = fun y -> f3(f3 y) in
let f5 = fun y -> f4(f4 y) in
f5 (fun z -> z)
@xem
xem / codegolf.md
Last active January 2, 2025 16:05
JS code golfing

codegolf JS

Mini projects by Maxime Euzière (xem), subzey, Martin Kleppe (aemkei), Mathieu Henri (p01), Litterallylara, Tommy Hodgins (innovati), Veu(beke), Anders Kaare, Keith Clark, Addy Osmani, bburky, rlauck, cmoreau, maettig, thiemowmde, ilesinge, adlq, solinca, xen_the,...

(For more info and other projects, visit http://xem.github.io)

(Official Slack room: http://jsgolf.club / join us on http://register.jsgolf.club)

@DavidPowell
DavidPowell / tikzmagic.py
Created October 21, 2014 22:50
Magic for tikz plots in the IPython notebook, modified to prevent SVG glyph crashes, and to enable a local copy of file
# -*- coding: utf-8 -*-
"""
=========
tikzmagic
=========
Magics for generating figures with TikZ.
.. note::
import subprocess, itertools, numpy
import matplotlib.pyplot as plt
command = 'git log --shortstat --log-size --format=oneline --no-merges'.split()
data = subprocess.check_output(command).split('\n')
def read_groups():
buf = []
for line in data:
buf.append(line)
@jepio
jepio / minted.py
Last active September 18, 2023 13:58
Pandoc filter to use minted for syntax highlighting
#!/usr/bin/env python3
'''
Filter to wrap Pandoc's CodeBlocks into minted blocks when using latex.
Pandoc's `fence_code_attributes` can be used to provide:
- the language (first class)
- minted's argumentless options (following classes)
- minted's options with arguments (attributes)
'''
@Naereen
Naereen / bh_core.sublime-settings
Last active February 6, 2016 00:28
Custom brackets for LaTeX+ for the BracketHighlighter Sublime Text 3 plugin
{
// Custom brackets for LaTeX+ for the BracketHighlighter Sublime Text 3 plugin
// Needs the LaTeX+ plugin from https://github.com/randy3k/Latex-Plus/
// And the BracketHighlighter plugin from https://github.com/facelessuser/BracketHighlighter
// Based on this page https://github.com/randy3k/Latex-Plus/wiki/BracketHighlighter-settings
//
// HowTo use: save this to Packages/User/bh_core.sublime-settings
// (or Menu > Preferences > Package Settings > BracketHighlighter > Brackets Settings - User)
//
// FIXME reorder the objects in a more logical fashion
@benhoyt
benhoyt / ngrams.py
Created May 12, 2016 15:34
Print most frequent N-grams in given file
"""Print most frequent N-grams in given file.
Usage: python ngrams.py filename
Problem description: Build a tool which receives a corpus of text,
analyses it and reports the top 10 most frequent bigrams, trigrams,
four-grams (i.e. most frequently occurring two, three and four word
consecutive combinations).
NOTES