Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

SinaiHao roachsinai

🌴
On vacation
Block or report user

Report or block roachsinai

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@roachsinai
roachsinai / event.cpp
Created May 24, 2019 — forked from darkf/event.cpp
Simple event system in C++
View event.cpp
#include <functional>
#include <map>
#include <typeinfo>
#include <iostream>
struct Event {
virtual ~Event() {}
};
struct TestEvent : Event {
std::string msg;
@roachsinai
roachsinai / lisp.cpp
Created May 16, 2019 — forked from ofan/lisp.cpp
Lisp interpreter in 90 lines of C++
View lisp.cpp
Lisp interpreter in 90 lines of C++
I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second.
Just for fun I wondered if I could write one in C++. My goals would be
1. A Lisp interpreter that would complete Peter's Lis.py test cases correctly...
2. ...in no more than 90 lines of C++.
Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake!
View simple_vm.c
// https://www.zhihu.com/question/33084689/answer/58994758
#include <stdio.h>
#include <string.h>
typedef struct inst
{
unsigned char code; // 指令
unsigned char cond; // 执行该指令的条件
short p1, p2; // 参数1、2
@roachsinai
roachsinai / gist:e3888907e5ae098ce4571a10adc031bb
Created Nov 1, 2018
omz_diagnostic_dump for Home and End key work wierd.
View gist:e3888907e5ae098ce4571a10adc031bb
oh-my-zsh diagnostic dump
omz_diagdump_20181102-002850.txt
2018年 11月 02日 星期五 00:28:50 CST
Linux hmank 4.19.0-3-MANJARO #1 SMP PREEMPT Sat Oct 27 22:40:22 UTC 2018 x86_64 GNU/Linux
OSTYPE=linux-gnu
ZSH_VERSION=5.6.2
User: roach
umask: 022
You can’t perform that action at this time.