Skip to content

Instantly share code, notes, and snippets.

@Dubhead
Dubhead / gist:d8cfa77cad28394d318c
Created December 3, 2014 08:50
cannot build Falcon new_engine
on Fedora 20 x86_64, after setting all FALCON_BUILD_* to OFF in ccmake
% git log -1 HEAD | cat
commit 5c5ca3d39db30c22a4218bea40a45d2f94465f2d
Author: Giancarlo Niccolai <gc@niccolai.cc>
Date: Wed Dec 3 00:05:30 2014 +0100
Fixed compilation on FreeBSD 10.1 64Bit - Clang
%
% ninja-build -k 1000
@Dubhead
Dubhead / gist:a51904c9e55908c747d0
Last active August 29, 2015 14:21
「ソフトウェアエンジニアならば1時間以内に解けなければいけない5つの問題」の5問目を Pure で解いてみた
数式の文字列を eval できる言語ならどれでも大差なく解けそうなもの。
というわけで Pure (http://purelang.bitbucket.org/) で解いてみた。
#!/usr/bin/pure
using system; // for 'puts'
add100 acc 9
= puts acc if eval acc == 100;
= _ otherwise;
@Dubhead
Dubhead / searchOpenParen.vim
Created November 24, 2010 09:29
Vimで ( や ) を全然使わないので、「開き括弧へ移動する」という動作に割り当ててみた。
function! SearchOpenParenForward()
let l:_ = search("\\((\\|\\[\\|{\\|<\\|「\\|『\\)\\zs")
endfunction
function! SearchOpenParenBackward()
let l:_ = search("\\((\\|\\[\\|{\\|<\\|「\\|『\\)\\zs", 'b')
endfunction
noremap <silent> ) :call SearchOpenParenForward()<CR>
noremap <silent> ( :call SearchOpenParenBackward()<CR>
@Dubhead
Dubhead / gist:1058070
Created July 1, 2011 08:01
Emacsで、C-aやC-eの連打を1行スクロールにしてみた
(global-set-key (kbd "C-a")
'(lambda ()
(interactive)
(if (= (point) (line-beginning-position))
(scroll-down 1))
(beginning-of-line)))
(global-set-key (kbd "C-e")
'(lambda ()
(interactive)
#include <iostream>
class Foo {
public:
Foo() {}
void say() {
std::cout << data_ << std::endl;
}
@Dubhead
Dubhead / echo.cc
Created September 20, 2011 07:09
echo in C++11
// echo in C++11
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
int main(int argc, char* argv[])
{
std::vector<std::string> strings(argv + 1, argv + argc);
@Dubhead
Dubhead / stylizeline.vim
Created October 18, 2011 03:59
StylizeLine
" smartchr 的な動作は改行時にまとめてやれば済むでしょ、と思って簡単に作ってみた。
" どうも実用的にできなかったのでgistに晒して終わりにする。
function! StylizeLine(modifyBuffer)
let l:line = getline(".")
" Skip if comment line or preprocessor directive.
if (match(l:line, "^\\s*#") != -1) || (match(l:line, "^\\s*\/\/") != -1)
return l:line
endif
@Dubhead
Dubhead / stylizeline.vim
Created October 20, 2011 07:50
StylizeLine, take 2
" StylizeLine
" include guard
"if exists("g:loaded_StylizeLine") && g:loaded_StylizeLine
" finish
"endif
"let g:loaded_StylizeLine = 1
function! StylizeLine(modifyBuffer, lineOffset)
let l:line = getline(line(".") + a:lineOffset)
@Dubhead
Dubhead / goindent.vim
Created October 21, 2011 08:09
Go to the next (or previous) line with the same indentation to the current line (or less than), ignoring empty lines.
" GoUp
" include guard
"if exists("g:loaded_GoUp") && g:loaded_GoUp
" finish
"endif
"let g:loaded_GoUp = 1
" Go to the next (or previous) line with the same indentation to the
" current line (or less than), ignoring empty lines.
@Dubhead
Dubhead / gist:2049097
Created March 16, 2012 08:21
matrix product in Pure
% pure -i
Pure 0.52 (x86_64-unknown-linux-gnu) Copyright (c) 2008-2012 by Albert Graef
(Type 'help' for help, 'help copying' for license information.)
Loaded prelude from /usr/local/lib/pure/prelude.pure.
> sum = foldl (+) 0;
> dot x::matrix y::matrix = sum $ zipwith (*) (rowvector x) (rowvector y);
> x::matrix * y::matrix = {dot u v | u = rows x; v = cols y};
> a = {1, 2, 3; 1, 2, 3; 1, 2, 3};
> b = {1, 2, 3, 4; 1, 2, 3, 4; 1, 2, 3, 4};