Skip to content

Instantly share code, notes, and snippets.

View zhhailon's full-sized avatar

zhhailon zhhailon

View GitHub Profile
/** List abstract class. */
template <typename ItemType> class List {
public:
virtual int size() const = 0;
virtual ItemType &get(int i) = 0;
virtual const ItemType &get(int i) const = 0;
virtual void insert(const ItemType &x, int i) = 0;
virtual ItemType remove(int i) = 0;
virtual void addFirst(const ItemType &x) = 0;
virtual void addLast(const ItemType &x) = 0;
template <typename T> class ArraySet {
private:
T *items;
int count;
public:
/** Create an empty set. */
ArraySet() {
items = new T[100];
count = 0;
#include <iostream>
class IntList {
public:
int first;
IntList *rest;
IntList(int f, IntList *r = nullptr) {
first = f;
rest = r;
@zhhailon
zhhailon / SLList.cpp
Last active September 17, 2021 15:28
#include <iostream>
class IntNode {
public:
int item;
IntNode *next;
IntNode(int i, IntNode *n) {
item = i;
next = n;
sudo apt-get update
sudo apt-get dist-upgrade
sudo rpi-update
sudo apt-get install dnsmasq hostapd
sudo systemctl stop dnsmasq
sudo systemctl stop hostapd
# /etc/dhcpcd.conf
interface wlan0
static ip_address=192.168.4.1/24
@zhhailon
zhhailon / android-hotfix.md
Last active March 28, 2017 15:58
Android Hotfix
#!/usr/bin/env python
import argparse
from os import chdir, getcwd, listdir
from os.path import realpath
from shutil import move
class PushdContext:
cwd = None
original_dir = None
import java.net.*;
import java.io.*;
/**
* A very simple web server.
* @author zhhailon
*/
public class MiniWebServer {
protected void start() {
@zhhailon
zhhailon / The Gettysburg Address by Abraham Lincoln
Last active March 18, 2016 19:03
The most famous speech by President Abraham Lincoln
Four score and seven years ago our fathers brought
forth on this continent, a new nation, conceived in
Liberty, and dedicated to the proposition that all
men are created equal.
Now we are engaged in a great civil war, testing
whether that nation, or any nation so conceived and
so dedicated, can long endure. We are met on a great
battle-field of that war. We have come to dedicate
a portion of that field, as a final resting place for
/*
2 Given a binary tree, print out all of its root-to-leaf
3 paths, one per line. Uses a recursive helper to do the work.
4 */
void printPaths(struct node* node) {
int path[1000];
printPathsRecur(node, path, 0);
}
/*