Skip to content

Instantly share code, notes, and snippets.

@yun-cloud
yun-cloud / main.cpp
Created November 19, 2016 10:05 — forked from brotchie/main.cpp
Minimal C++ implementation of Functor, Monad and Maybe using c++0x variadic templates and lambda expressions.
/*
* Minimal C++ implementation of Functor, Monad and Maybe.
*
* Requires c++0x variadic templates and lambda expressions:
*
* g++ -std=c++0x main.cpp -o main
*
* fmap, monadic bind and return implementations for std::vector
* and Maybe.
*
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
int str2int(const string& s)
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
int max_path_weight(const vector<int>& tree, int index)
{
@yun-cloud
yun-cloud / hw7-2
Created April 25, 2017 11:46 — forked from anonymous/hw7-2
#include "function.h"
using namespace std;
Polynomial::Polynomial()
{
greatestPower=0;
coefficients[0]=0;
}
Polynomial::Polynomial(const int N, const int C[51])
{
@yun-cloud
yun-cloud / nachos-helper.sh
Last active January 27, 2018 07:58
help you rebuild nachos and test your HW. Remember to change the variable, _base, to your project directory using 'pwd' command.
#!/bin/bash
_script="$(readlink -f ${BASH_SOURCE[0]})"
_base="$(dirname $_script)"
log_dir="${_base}/log"
mkdir -p ${log_dir}
BLACK=$(tput setaf 0)
RED=$(tput setaf 1)
@yun-cloud
yun-cloud / common-log-func.sh
Last active January 8, 2020 07:58
some common used function, to show the infomation.
BLACK="$(tput setaf 0; tput bold)"
RED="$(tput setaf 1; tput bold)"
GREEN="$(tput setaf 2; tput bold)"
YELLOW="$(tput setaf 3; tput bold)"
BLUE="$(tput setaf 4; tput bold)"
MAGENTA="$(tput setaf 5; tput bold)"
CYAN="$(tput setaf 6; tput bold)"
WHITE="$(tput setaf 7; tput bold)"
BOLD="$(tput bold)"
RESET="$(tput sgr0)"
@yun-cloud
yun-cloud / init.vim
Last active January 26, 2018 13:12
neovim on megumin server: doing llvm
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" dependency "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 1. neovim
" 2. python3
" 3. pip install neovim
" 4. devicons: nerd font
" 5. clang-format: clang
"
@yun-cloud
yun-cloud / init.vim
Created January 26, 2018 11:56
nvimrc on windows with neovim-qt
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" dependency "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 1. neovim
" 2. python3
" 3. pip install neovim
" 4. devicons: nerd font
" 5. clang-format: clang
"
@yun-cloud
yun-cloud / vimrc_on_OS_server
Last active April 8, 2018 06:27
vimrc on OS server
if empty(glob('~/.vim/autoload//plug.vim'))
silent !curl -fLo ~/.vim/autoload//plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
call plug#begin('~/.vim/plugged')
" Misc
Plug 'jiangmiao/auto-pairs'
Plug 'mhinz/vim-startify'
Plug 'tpope/vim-surround'
@yun-cloud
yun-cloud / .vimrc
Last active May 15, 2018 11:04
.vimrc on compiler server
if empty(glob('~/.vim/autoload//plug.vim'))
silent !curl -fLo ~/.vim/autoload//plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
call plug#begin('~/.vim/plugged')
" Misc
Plug 'tpope/vim-sensible'
Plug 'jiangmiao/auto-pairs'
"Plug 'mhinz/vim-startify'
Plug 'tpope/vim-surround'