Skip to content

Instantly share code, notes, and snippets.

View bynect's full-sized avatar
🙄
Procrastinating

nect bynect

🙄
Procrastinating
  • Laniakea Supercluster
  • 02:54 (UTC +02:00)
View GitHub Profile
@nicuveo
nicuveo / Main.hs
Last active November 3, 2022 09:23
Minimalistic JSON parser, using a Parsec-like approach
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE LambdaCase #-}
import Control.Applicative (liftA2)
import Data.Char
import Data.Foldable (for_)
import Data.Functor
import qualified Data.HashMap.Strict as M
import Data.List (intercalate)
import Prelude hiding (any)
//
// Author: Jonathan Blow
// Version: 1
// Date: 31 August, 2018
//
// This code is released under the MIT license, which you can find at
//
// https://opensource.org/licenses/MIT
//
//
@iamgreaser
iamgreaser / infix-mode.cl
Last active March 1, 2022 20:23
infix notation for common lisp - first reader macro attempt
;; vim: set sts=2 sw=2 et sm lisp :
(defvar *reading-a-list* nil)
(defun read-terminator (stream char)
(declare (ignore stream))
(error (format nil "unexpected ~S" char)))
(defun get-infix-precedence (symbol)
(case symbol
@nimaai
nimaai / macro-pitfalls.md
Last active February 4, 2024 21:37
Lisp macro pitfalls
@messa
messa / asyncio_ssl_example.py
Created June 26, 2015 12:43
Python asyncio + SSL TCP client/server example
#!/usr/bin/env python3
import asyncio
import multiprocessing
import os
import ssl
from time import sleep
port = 9000
@jozefg
jozefg / infer.sig
Last active February 9, 2022 11:59
A demonstration of type inference in SML
signature TYPEINFER =
sig
type tvar = int
datatype monotype = TBool
| TArr of monotype * monotype
| TVar of tvar
datatype polytype = PolyType of int list * monotype
datatype exp = True
| False
| Var of int
@luser-dr00g
luser-dr00g / xcr.c
Created August 30, 2014 09:35
xcb+cairo hello world window
//xcr.c
//cc -o xcr $(pkg-config --cflags --libs cairo xcb xcb-icccm) xcr.c -lcairo -lxcb -lxcb-icccm
#include <stdlib.h>
#include <string.h>
#include <cairo.h>
#include <cairo-xcb.h>
#include <xcb/xcb.h>
#include <xcb/xcb_image.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_icccm.h>
@jozefg
jozefg / closconv.lhs
Last active March 5, 2024 11:52
Tutorial on Closure Conversion and Lambda Lifting
This is my short-ish tutorial on how to implement closures in
a simple functional language: Foo.
First, some boilerplate.
> {-# LANGUAGE DeriveFunctor, TypeFamilies #-}
> import Control.Applicative
> import Control.Monad.Gen
> import Control.Monad.Writer
> import Data.Functor.Foldable
@ianmackinnon
ianmackinnon / match.c
Created August 8, 2012 12:01
C Regex multiple matches and groups example
# gcc -Wall -o match match.c && ./match
#
#include <stdio.h>
#include <string.h>
#include <regex.h>
@jmingtan
jmingtan / autoreload.py
Created August 25, 2011 17:52
Autoreload is a simple python script to watch a directory for changed files and restarts a process when the change is detected.
#!/usr/bin/env python
""" An extension of Steve Krenzel's autoreload script (https://github.com/stevekrenzel/autoreload)
Changes:
1. Allow user specified file extension white lists
2. Check if a process is alive before killing it
What follows is the original README.md file: