Skip to content

Instantly share code, notes, and snippets.

@ufcpp
ufcpp / MagicallyResolvedOverload.cs
Last active March 29, 2018 11:00
C# 7.3触り出してみてる
using System;
using System.Collections.Generic;
namespace MagicallyResolvedOverload
{
/// <summary>
/// これまで、class だったら T、struct だったら T? を返す、みたいな処理書けなかったんだけど。
/// ちょっと無理やりだけど、C# 7.3 でできなくはない状態に。
/// </summary>
public static class EnumerableEx
@deris
deris / 1_176_vimrc_reading.vim
Created November 19, 2015 16:54
vimrc読書会の1回目から176回目までに読んだvimrcからVim pluginを雑に抽出したリスト
NeoBundle '2072/PHP-Indenting-for-VIm'
NeoBundle '29decibel/codeschool-vim-theme'
NeoBundle '5long/pytest-vim-compiler'
NeoBundle '5t111111/alt-gtags.vim'
NeoBundle '5t111111/markdown-preview.vim'
NeoBundle '5t111111/neat-json.vim'
NeoBundle 'Align'
NeoBundle 'AndrewRadev/inline_edit.vim'
NeoBundle 'AndrewRadev/multichange.vim'
NeoBundle 'AndrewRadev/splitjoin.vim'
@inaz2
inaz2 / brainfuck.s
Last active March 15, 2020 14:58
x86 brainfuck interpreter
/* brainfuck.s */
.intel_syntax noprefix
.globl _start
_start:
lea edx, mem
lea esi, bfcode
loop:
mov al, [esi]
@ynkdir
ynkdir / cc500.vim
Created December 1, 2014 15:53
cc500.vim
" This is a port of CC500
" http://homepage.ntlworld.com/edmund.grimley-evans/cc500/
"
"-------------------------------------------------------------------------------
" ORIGINAL HEADER
"-------------------------------------------------------------------------------
" Copyright (C) 2006 Edmund GRIMLEY EVANS <edmundo@rano.org>
"
" This program is free software; you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
@hi2p-perim
hi2p-perim / ssecheck.cpp
Last active June 16, 2024 06:55
Check SSE/AVX instruction support.
/*
Check SSE/AVX support.
This application can detect the instruction support of
SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4a, SSE5, and AVX.
*/
#include <iostream>
#ifdef _MSC_VER
#include <intrin.h>
#endif
@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@t-mat
t-mat / 00cpuid.md
Last active March 28, 2024 12:39
CPUIDを使ってCPUの情報を取得する
  • Pentium 以降の世代の CPU なら問題なく実行できる
  • VC++ (2005 以降?) なら <intrin.h>#include して、__cpuid() および __cpuidex() を使用する
  • gcc なら <cpuid.h>#include して、__get_cpuid(), __cpuid_count() を使用する
  • RDRAND を使ってみたかったのだけど、うちのは対応していなかった!
fizz = function f() {
fizz = function () {
fizz = function () {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {
@ofan
ofan / lisp.cpp
Last active April 11, 2024 11:28
Lisp interpreter in 90 lines of C++
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!