Skip to content

Instantly share code, notes, and snippets.

@mobius
mobius / lisp_in_200_cpp_lines.cpp
Created December 1, 2010 02:56
Lisp interpreter in 200 lines
// Scheme Interpreter in 90 lines of C++ (not counting lines after the first 90).
// Inspired by Peter Norvig's Lis.py.
// Copyright (c) 2010 Anthony C. Hay. This program leaks memory.
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <map>
@mobius
mobius / Program.cs
Created May 31, 2011 04:28
C# startup a process in hidden mode
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace RunAsHidden
{
class Program
{
@mobius
mobius / libzip_simple.c
Last active May 19, 2024 10:47
using libzip to extract files
/* Copyright (C) 2011 rocenting#gmail.com */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/resource.h>
@mobius
mobius / min_ogl.c
Created March 11, 2012 12:37
minimum file for create a opengl context
/* An example of the minimal Win32 & OpenGL program. It only works in
16 bit color modes or higher (since it doesn't create a
palette). */
#include <windows.h> /* must include this before GL/gl.h */
#include <GL/gl.h> /* OpenGL header file */
#include <GL/glu.h> /* OpenGL utilities header file */
#include <stdio.h>
@mobius
mobius / forceinline.h
Created March 20, 2012 01:28
forceinline defines
#ifndef FORCEINLINE
#if defined(__GNUC__)
#define FORCEINLINE __inline __attribute__ ((always_inline))
#elif defined(_MSC_VER)
#define FORCEINLINE __forceinline
#endif
#endif
#ifndef NOINLINE
#if defined(__GNUC__)
#define NOINLINE __attribute__ ((noinline))
@mobius
mobius / mathjax.html
Last active December 10, 2015 19:29
basic page of MathJax
<!DOCTYPE html>
<html>
<title> MathJax Tex Test Page</title>
<head>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(', '\\)']]},
processEscape: true,
TeX: { equationNumbers: { autoNumber: "AMS"}}
});
@mobius
mobius / gist:4618319
Created January 24, 2013 07:25
Putty with tmux with Solarized theme
https://github.com/seebi/tmux-colors-solarized
https://github.com/altercation/solarized/tree/master/putty-colors-solarized
https://puttytray.goeswhere.com/
https://github.com/altercation/ethanschoonover.com/blob/master/projects/solarized/README.md
@mobius
mobius / test.cc
Created January 31, 2013 00:58
fast test for lambda function
#include <stdio.h>
#include <functional>
void foo( int i )
{
auto f = [=]() { printf("%d\n", i); };
f();
}
@mobius
mobius / markdownWorker.js
Last active May 1, 2016 18:21
visual studio code markdown for mathjax syntax
/*!--------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
/**
* marked - a markdown parser
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
* https://github.com/chjj/marked
*/
function Lexer(e) {
this.tokens = [], this.tokens.links = {}, this.options = e || marked.defaults, this.rules = block.normal, this.options.gfm && (this.options.tables ? this.rules = block.tables : this.rules = block.gfm)
@mobius
mobius / convert_winform.py
Created April 5, 2016 07:48
convert winform designer generated InitializeComponents to ironpython script
# remove various cast
replace \(\([\w.]+\)
with (
# change this with self
# change size 10F to 10
replace (\d+)F
with $1
# replace } as ,) replace { as ( when AddRange