This file contains hidden or 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
#pragma once | |
#include <iostream> | |
#include <string> | |
#include <memory> | |
#include <cstdio> | |
#include <cstdarg> | |
using namespace std; |
This file contains hidden or 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
##### hello.rb | |
#!/usr/bin/env ruby | |
require 'daemons' | |
require 'logger' | |
# Initialize | |
logpath = File.expand_path("app.log") | |
log = Logger.new(logpath) | |
log.info("Completely initialized") |
This file contains hidden or 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
# lib/capistrano/rvm.cap | |
namespace :rvm do | |
desc 'RVM install in :rvm_type or :rvm_custom_path' | |
task :install do |host| | |
on roles(:app) do | |
rvm_path = '~/.rvm' | |
#rvm_path = '/usr/local/rvm' if :rvm_type == :system | |
#rvm_path = :rvm_custom_path if :rvm_custom_path | |
rvm_dir = File.dirname(rvm_path) | |
execute "mkdir -p #{rvm_path} && cd #{rvm_dir} && curl -L https://get.rvm.io | bash" |
This file contains hidden or 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
#pragma once | |
#include <cstdio> | |
#include <iostream> | |
#include <memory> | |
#include <stdexcept> | |
class invalid_command : std::runtime_error { | |
public: | |
invalid_command(const std::string &cause) |
This file contains hidden or 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
#!/bin/ruby | |
require 'thread' | |
class ThreadPool | |
def initialize(size, &session) | |
@size = size | |
@queue = SizedQueue.new(size) | |
@map = {} | |
@map_mutex = Mutex.new | |
session.call(self) |
This file contains hidden or 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
*** ruby-2.0.0-p353/file.c.origin 2014-02-03 14:10:23.019204500 +0900 | |
--- ruby-2.0.0-p353/file.c 2014-02-03 14:10:50.577250200 +0900 | |
*************** | |
*** 4181,4187 **** | |
#ifdef __CYGWIN__ | |
#include <winerror.h> | |
! extern unsigned long __attribute__((stdcall)) GetLastError(void); | |
#endif |
This file contains hidden or 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
*** ruby-1.9.3-p484.origin/file.c 2013-07-10 10:33:05.000000000 +0900 | |
--- ruby-1.9.3-p484/file.c 2014-02-03 14:17:21.054461600 +0900 | |
*************** | |
*** 4126,4132 **** | |
#ifdef __CYGWIN__ | |
#include <winerror.h> | |
! extern unsigned long __attribute__((stdcall)) GetLastError(void); | |
#endif |
This file contains hidden or 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
# Makefile for iVerilog testing | |
SRC_DIR := src | |
TEST_DIR := test | |
SIM_DIR := sim | |
TESTS := $(sort $(patsubst $(TEST_DIR)/%.v,$(SIM_DIR)/%.vcd,$(wildcard $(TEST_DIR)/test_*.v))) | |
VERILOGS := $(sort $(wildcard $(SRC_DIR)/*.v)) | |
.PHONY: $(SIM_DIR)/test_%.sim | |
$(SIM_DIR)/test_%.sim: $(TEST_DIR)/test_%.v |
This file contains hidden or 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
#pragma once | |
#include <algorithm> | |
template<class Iterator> | |
bool next_combination(Iterator first1, Iterator last1, Iterator first2, Iterator last2) { | |
if((first1 == last1) || (first2 == last2)) return false; | |
Iterator m1 = last1, m2 = last2; --m2; | |
while(--m1 != first1 && !(*m1 < *m2)) {} | |
const bool result = !((m1 == first1) && !(*first1 < *m2)); |
This file contains hidden or 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
#pragma once | |
#include <vector> | |
template<class T, size_t N = 1> | |
class vec : public std::vector<vec<T,N-1>> { | |
public: | |
explicit vec() : std::vector<vec<T,N-1>>() {} | |
template<class Size, class... Sizes> | |
explicit vec(Size n, Sizes... ns) : std::vector<vec<T,N-1>>(n,vec<T,N-1>(ns...)) {} |
OlderNewer