Skip to content

Instantly share code, notes, and snippets.

View bruceoutdoors's full-sized avatar
🧗

Lee Zhen Yong bruceoutdoors

🧗
View GitHub Profile
@bruceoutdoors
bruceoutdoors / Signal.hpp
Last active December 29, 2017 15:29
Simple implementation of the Signal and Slot (Observer pattern) mechanism.
/**
* Signal.hpp
* - Simple implementation of the Signal and Slot (Observer pattern) mechanism.
* Requires C++11 compatible compiler.
*
* @author Lee Zhen Yong
*/
#pragma once
/******************************************************************************
* Execution: ./DisjointSet < input.txt
* Data files: http://algs4.cs.princeton.edu/15uf/tinyUF.txt
* http://algs4.cs.princeton.edu/15uf/mediumUF.txt
* http://algs4.cs.princeton.edu/15uf/largeUF.txt
*
* Weighted quick-union by rank with path compression.
*
* % ./DisjointSet < tinyUF.txt
* 4 3
@bruceoutdoors
bruceoutdoors / charcast.cpp
Created May 18, 2017 13:52
from int cast to byte, from byte extract hex values.
#include <iostream>
using namespace std;
struct Byte {
void to4Bits(char c)
{
lo = c >> 4;
hi = c & 0x0F;
}
#include <iostream>
#include <complex>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
using namespace std;
#include <iostream>
#include <complex>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;
typedef complex<double> xd;
#include <iostream>
#include <complex>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
using namespace std;
#include <iostream>
#include <complex>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;
double PI = acos(0) * 2;
#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> ivec;
ivec polynomialMultiply(const ivec &a, const ivec &b)
{
int N = 2 * a.size() - 1;
@bruceoutdoors
bruceoutdoors / krita-builder.bat
Last active September 25, 2016 04:01
Krita build batch script.
:: =================== READ ME BEFORE USE!! ============================
:: This build script assumes that cmake, python, TDM-GCC (with OpenMP)
:: is in your environment paths.
::
:: It also uses Ninja to build Krita (it builds considerably faster!).
:: Make sure that ninja executable is in your PATHS also.
::
:: Run this script in administrator mode. Make sure you have a stable
:: internet connection.
::
% BEGIN -- SETUP DOCUMENT (OVERLEAF) --
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=apa]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\usepackage[pdftex]{graphicx}
\addbibresource{ref.bib}
\let\cite\parencite