Skip to content

Instantly share code, notes, and snippets.

@gyx9208
gyx9208 / ExpressionParser.cs
Created January 21, 2019 07:03
Expression Parser
/* * * * * * * * * * * * * *
* A simple expression parser
* --------------------------
*
* The parser can parse a mathematical expression into a simple custom
* expression tree. It can recognise methods and fields/contants which
* are user extensible. It can also contain expression parameters which
* are registrated automatically. An expression tree can be "converted"
* into a delegate.
*
@tiancaiamao
tiancaiamao / parsec.ml
Last active April 8, 2017 15:32
a toy parser combinator
type 'a parser_t = char list -> ('a * char list) option
let satisfy pred = function [] -> None | x::xs -> if pred x then Some(x,xs) else None;;
let range a b = satisfy (fun x -> x>=a && x <=b);;
let exactly x = satisfy ((=) x);;
let (<|>) p q = fun x -> match p x with Some _ as res -> res | None -> q x;;
let (>>=) m f = fun l -> match m l with
| None -> None
| Some(res, l1) -> f res l1;;
let return x = fun l -> Some(x, l);;
@mick001
mick001 / convolutional_nn_tutorial_3.R
Last active May 7, 2019 09:36
Image recognition tutorial in R using deep convolutional neural networks (MXNet package). Part 3. Full article at https://firsttimeprogrammer.blogspot.com/2016/08/image-recognition-tutorial-in-r-using.html
# Clean workspace
rm(list=ls())
# Load MXNet
require(mxnet)
# Loading data and set up
#-------------------------------------------------------------------------------
# Load train and test datasets
@chrissimpkins
chrissimpkins / gist:5bf5686bae86b8129bee
Last active June 19, 2024 18:05
Atom Editor Cheat Sheet: macOS

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@r10r
r10r / gist:2305091
Created April 4, 2012 19:49
embed SWT widget into Swing JFrame
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.browser.Browser;
import bisect
class NFA(object):
EPSILON = object()
ANY = object()
def __init__(self, start_state):
self.transitions = {}
self.final_states = set()
self._start_state = start_state