Skip to content

Instantly share code, notes, and snippets.

View eclipselu's full-sized avatar
🏠
Working from home

Lu Dang eclipselu

🏠
Working from home
  • Kitchener, Ontario
View GitHub Profile
@eclipselu
eclipselu / jigsaw_solver.cpp
Created April 5, 2012 12:53
An Automatic Square Jigsaw Solver
#include <opencv.hpp>
#include <vector>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <string>
#include <iostream>
using namespace cv;
using namespace std;
@eclipselu
eclipselu / .vimrc
Last active January 26, 2018 13:41
my vimrc
"vim: curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"neovim: curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" Using vim-plug
call plug#begin('~/.vim/plugged')
" UI
Plug 'iCyMind/NeoSolarized'
Plug 'bronson/vim-trailing-whitespace'
Plug 'machakann/vim-highlightedyank'

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

/* Our own header, to be included before all standard system headers */
#ifndef _APUE_H
#define _APUE_H
#if defined(SOLARIS)
#define _XOPEN_SOURCE 500 /* Single UNIX Specification, Version 2 for Solaris 9 */
#define CMSG_LEN(x) _CMSG_DATA_ALIGN(sizeof(struct cmsghdr)+(x))
#elif !defined(BSD)
#define _XOPEN_SOURCE 600 /* Single UNIX Specification, Version 3 */
/**
* determines whether a string is numeric
* LeetCode: http://oj.leetcode.com/problems/valid-number/
*/
class Solution {
public:
bool isSign(const char c) {
return c == '-' || c == '+';
}
class Solution {
public:
bool isNumber(const char *s) {
if (!s) return false;
bool sign = true; bool num = false;
bool e = true; bool dot = true; int space = 0;
char c;
while (c=*s++) {
if (c != ' ' && space == 2) return false;
#include <cstdio>
#include <queue>
#include <iostream>
#include <string>
#include <bitset>
using namespace std;
const int rows = 4, cols = 4;
const int max_num = 1<<(rows * cols);
#include <cstdio>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>
#include <climits>
using namespace std;
const int rows = 4, cols = 5;
/**
* Definition for an interval.
* struct Interval {
* int start;
* int end;
* Interval() : start(0), end(0) {}
* Interval(int s, int e) : start(s), end(e) {}
* };
*/

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname