Skip to content

Instantly share code, notes, and snippets.

View xmonader's full-sized avatar
🏠
Working from home

xmonader xmonader

🏠
Working from home
View GitHub Profile
@mie00
mie00 / mon.sh
Last active September 6, 2018 14:08
A script to dump data from and to your service
#!/bin/bash
# Usage: ./my-service --listen=127.0.0.1:`mon 8080`
PORT=$(( ((RANDOM<<15)|RANDOM) % 63001 + 2000 ))
echo "$PORT"
socat -v TCP4-LISTEN:"$1",bind=127.0.0.1,reuseaddr,fork TCP4:"${2:-127.0.0.1}":$PORT >&2 & !
@Al-Muhandis
Al-Muhandis / freepascal-telegram-links.md
Created February 5, 2018 14:24
Useful links about freepascal in telegram and telegram in freepascal (and Lazarus IDE)
@OmarElawady
OmarElawady / murder.py
Created December 6, 2020 18:23
Murder puzzle using or tools
from ortools.sat.python import cp_model
persons = ['robert', 'john', 'george', 'yolando', 'christine', 'barbara']
rooms = ['kitchen', 'bathroom', 'dining', 'living', 'pantry', 'study']
weapons = ['bag', 'firearm', 'gas', 'knife', 'poison', 'rope']
robert, john, george, yolando, christine, barbara = 0, 1, 2, 3, 4, 5
kitchen, bathroom, dining, living, pantry, study = 0, 1, 2, 3, 4, 5
bag, firearm, gas, knife, poison, rope = 0, 1, 2, 3, 4, 5
@rylev
rylev / rust-in-large-organizations-notes.md
Last active February 2, 2023 10:08
Rust in Large Organizations Notes

Rust in Large Organizations

Initially taken by Niko Matsakis and lightly edited by Ryan Levick

Agenda

  • Introductions
  • Cargo inside large build systems
  • FFI
  • Foundations and financial support
@sdiehl
sdiehl / state.hs
Created January 13, 2015 18:44
State monad implementation + example
import Control.Monad
-------------------------------------------------------------------------------
-- State Monad Implementation
-------------------------------------------------------------------------------
newtype State s a = State { runState :: s -> (a,s) }
instance Monad (State s) where
return a = State $ \s -> (a, s)
@mikehaertl
mikehaertl / gist:3258427
Created August 4, 2012 15:40
Learn you a Haskell - In a nutshell

Learn you a Haskell - In a nutshell

This is a summary of the "Learn You A Haskell" online book under http://learnyouahaskell.com/chapters.


1. Introduction

  • Haskell is a functional programming language.
@fay59
fay59 / Quirks of C.md
Last active January 23, 2024 04:24
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;

Crafting a Compiler from Scratch: Implementation Notes

For the past two weeks or so, I've been working on a little compiler project in C, mostly for educational purposes, i.e. to understand how a compiler really works. I'm not using any libraries, other than the C runtime library.

Introduction

I have a hand-written lexer and parser, and a simple code generator targetting