This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add a value to an environmental variable while avoiding putting an unnecessary colon. | |
# Usage: add_env_with_colon PATH $HOME/local/bin | |
function add_env_with_colon { | |
ENV_VAR_NAME=$1 | |
VALUE_TO_ADD=$2 | |
CURRENT_VALUE=${!ENV_VAR_NAME} | |
if [ -n "$CURRENT_VALUE" ]; then | |
export $ENV_VAR_NAME=$VALUE_TO_ADD:$CURRENT_VALUE | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- module(find_unique_n, [find_unique_n/4]). | |
:- meta_predicate find_unique_n(?,?,:,?). | |
:- use_module(library(ordsets)). | |
:- use_module(library(lists)). | |
find_unique_n(N, Term, Goal, Solutions) :- | |
N > 0, | |
( retractall(unique_solutions(_)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <memory> | |
#include <random> | |
#include <caffe/caffe.hpp> | |
#include <glog/logging.h> | |
int main(int argc, char** argv) { | |
// glogの初期化 | |
google::InitGoogleLogging(argv[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <array> | |
#include <iostream> | |
#include <random> | |
int main() { | |
constexpr std::array<double, 3> fitness_values = {1, 1.5, 2}; | |
// Constructor is O(n) | |
std::discrete_distribution<std::size_t> dist(fitness_values.begin(), fitness_values.end()); | |
std::array<size_t, 3> table; | |
table.fill(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CMakeLists.txt that makes all the header and source files visible from Qt Creator | |
cmake_minimum_required(VERSION 2.8) | |
execute_process( | |
COMMAND find . -name *.cpp -or -name *.hpp -or -name *.h -or -name *.cc -or -name *.hh | |
COMMAND tr "\n" ";" | |
OUTPUT_VARIABLE QTCREATOR_SRCS | |
OUTPUT_STRIP_TRAILING_WHITESPACE | |
) | |
add_custom_target(qtcreator SOURCES ${QTCREATOR_SRCS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Move the current window left/right by Ctrl+Shift+Left/Right | |
bind-key -n C-S-Left swap-window -t -1 | |
bind-key -n C-S-Right swap-window -t +1 | |
# Move to the prev/next window by Shift+Left/Right | |
bind-key -n S-Left prev | |
bind-key -n S-Right next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Common macros | |
CXX := g++ | |
CXXFLAGS := -Wall -std=c++0x -I./src | |
# Macros for build | |
CXXFLAGS_RELEASE := -O3 -march=native -flto -DNDEBUG | |
CXXFLAGS_DEBUG := -g -O0 | |
CXX_FILES := $(shell find src \( -name \*.cpp -or -name \*.cc \) -print) | |
OBJS := $(shell echo $(CXX_FILES) | perl -p -e 's/.(cpp|cc)/.o/g') | |
TARGET := main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fizzbuzz(_n) :- | |
fizzbuzz_sequence(1, _n). | |
fizzbuzz_sequence(_max, _max) :- | |
fizzbuzz_number(_max), !. | |
fizzbuzz_sequence(_min, _max) :- | |
fizzbuzz_number(_min), | |
_next is _min + 1, | |
fizzbuzz_sequence(_next, _max). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; FizzBuzz in GDLv1 | |
; 2013/07/25 | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Role | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(role player) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" A sintax file for Gunbai Script (for SamurAI Coding 2013). | |
" | |
" Put this file in .vim/syntax/ and and add set filetype gunbai. | |
" Example: | |
" au BufRead,BufNewFile *.gb set filetype=gunbai | |
syntax region gunbaiLineComment start=+#+ end=+$+ | |
syntax keyword gunbaiConditional if elif else endif | |
syntax keyword gunbaiRepeat while endwhile | |
syntax keyword gunbaiCase break continue |
OlderNewer