Skip to content

Instantly share code, notes, and snippets.

@fyquah
fyquah / mine.c
Created March 23, 2016 13:35
mine.c
#include "shared_headers.h"
int my_fnc() {
int a = your_fnc();
return a + 1;
}
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLDtpnJJeJM7URrrcnXQjWBbuwAhzn/5Kf+YMH5qvFSIYpxorP97Ky5lSC8B8zH1E+xiSyTdSmBZcQddiuJu9RVKNMt9J1QPy5/PuIfaqWx6bbzV5J50sE9sIWob+HfHfnWlX9eUfoxWFyNLhhEVl2FrAvcSPYZcDq+TxsEGj9xpRhXVRZMUrum0nvI48w8lomhai7Q3kBQ8xN60B0TjRDSra4Lyq8E7rpfeWQwYrn3Hjp4t5LDeB+XMT11/zsyJF1ILUggNSxPkyzPbcaUYn4TuLH/Cs9HkcG8rgzuy0rlMpsZtZdJxDhS2alAgsmf72DRRZGzf8nCxlbsdBkrKJ5 [email protected]
@fyquah
fyquah / vim_fireplace_paredit_cheat_sheet.md
Created September 23, 2015 21:32 — forked from nblumoe/vim_fireplace_paredit_cheat_sheet.md
Simple cheat sheet for vim fireplace and paredit

fireplace

  • cpr => (require ... :reload)
  • cpR => (require ... :reload-all)

Evaluation

  • :Eval (clojure code) => runs (clojure code) in repl
  • cpp => evaluate inn-most expessions under cursor
  • cp<movement> => evaluate text described by <movement>
  • cqp => opens quasi-repl
  • cqc => quasi-repl command line window
@fyquah
fyquah / main.py
Created April 28, 2015 09:50
Game of Life
import random
def print_grid(grid):
for row in grid:
for cell in row:
print "* " if cell else " ",
print "\n"
def valid(grid, i, j):
return i >= 0 and i < len(grid) and j >= 0 and j < len(grid[0])
@fyquah
fyquah / install-qhost
Created August 26, 2014 10:44
Installing Qhost
cd $HOME
git clone https://github.com/fyquah95/qhost.git
gem install sinatra && gem install mercenary
mv qhost .qhost
mkdir -p $HOME/bin
ln -s $HOME/.qhost/qhost $HOME/bin/qhost
echo "$PATH=$HOME/bin:$PATH" >> $HOME/.bashrc
source $HOME/.bashrc
echo "installation is complete!"
@fyquah
fyquah / water.cpp
Created July 4, 2014 17:35
Standard Water Problem
#include <cstdio>
#include <queue>
#include <map>
#include <string>
#include <algorithm>
#include <sstream>
#include <iostream>
typedef long long ll;
using namespace std;
@fyquah
fyquah / segment_tree.h
Created June 27, 2014 13:31
Segment Tree with Lazy Propogation to find the maximum in a given range. Insert and query have execution time of O(log N) , memory O(N) [more exactly, 9N * [data-type-size] ]
#include <vector>
#include <algorithm>
const int inf = 1 << 30;
class SegmentTree
{
public:
SegmentTree(int n);
SegmentTree(int n , const int * arr);
@fyquah
fyquah / binary_index_tree.h
Last active August 29, 2015 14:03
Binary Index Tree Data Structure (Only for integer)
#include <vector>
class BinaryIndexTree
{
public:
BinaryIndexTree(int n);
void set(int index , int value);
int get(int index);
int size(){
return this->tree.size();
@fyquah
fyquah / trie.h
Last active August 29, 2015 14:03
Trie Implementation in C++
#include <vector>
#include <cstring>
#include <string>
class Vertex
{
public:
int words;
int prefixes;
int index;
@fyquah
fyquah / disjoint_set_union.h
Last active November 22, 2017 15:01
Disjoint Set Union Implementation in C++
#include <cstring>
class Disjoint_Union
{
public:
Disjoint_Union(const int & n);
int create();
void merge(int i , int j);
int find(const int & i);
int size(){