Skip to content

Instantly share code, notes, and snippets.

View yunpengn's full-sized avatar
:octocat:
Coding

Yunpeng Niu yunpengn

:octocat:
Coding
View GitHub Profile
@yunpengn
yunpengn / CodeQuality.java
Last active September 2, 2017 02:28
Code quality exercise for CS2103T @ NUS SoC (AY2017/2018 Semester 1)
public Class CodeQuality {
private static final String MESSAGE_COMMAND_HELP_PARAMETER = "Parameters: %1$s";
private static final String MESSAGE_COMMAND_HELP_EXAMPLE = "Example: %1$s";
private static final String MESSAGE_COMMAND_INVALID_FORMAT = "Invalid command format: %1$s";
private static final String MESSAGE_DISPLAY_PERSON_DATA = "%1$s Phone Number: %2$s Email: %3$s";
private static final String MESSAGE_GOODBYE = "Exiting Address Book... Good bye!";
/** List of all persons in the address book. */
private static final ArrayList<String> people = new ArrayList<>();
@yunpengn
yunpengn / BoxItemCard.java
Created September 6, 2017 02:15
[CS2103T][W4.3d][Exercise 1] at https://nus-cs2103.github.io/website/
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
Item item1 = new Item();
Item item2 = new Item();
Box box1 = new Box(item1);
Box box2 = new Box(item2);
item2.setMainCard(new Card());
@yunpengn
yunpengn / PersonAddressContactNumber.java
Last active September 6, 2017 09:47
CS2103T AY2017/2018 Semester 1
package classObjectDiagram;
public class Main {
public static void main(String[] args) {
// Step 1
Address homeA = new Address("Prince George's Park");
// Step 2
Person a = new Person("Alfred", homeA);
Person b = new Person("Bruce", homeA);
@yunpengn
yunpengn / specification.md
Last active April 11, 2018 17:39
CS2102 Project Technical Specification
@yunpengn
yunpengn / copyright.tex
Last active August 26, 2018 04:25
Copyright notes for Yunpeng's CS1101S slides
@yunpengn
yunpengn / main.js
Last active September 27, 2018 16:08
To teach JavaScript without the dot operator (this is supported by Common.js & Node.js)!
require("./utils.js");
// `add` is inserted into global frame. Do not need `utils.add` anymore!
add(1, 2);
@yunpengn
yunpengn / download.js
Created June 9, 2019 07:18
A useful script to download online course videos
// Imports the required libraries.
const https = require('https');
const fs = require('fs');
// Defines some constants.
const COURSE_HOMEPAGE = '<CHANGE_IT_HERE>';
// Parses the given JSON file regarding URLs.
const url_json = require('./restricted_files.json');
const url_list = url_json.data.getRestrictedFiles.urls;
@yunpengn
yunpengn / run_calcite.sh
Last active January 12, 2020 14:06
A simple Bash script to run Calcite & SQLidate
# Validates input.
if [[ "$1" == "" ]]; then
printf "Please specify the number of nodes.\n"
exit
fi
# Pulls the latest changes.
printf "Going to pull the latest changes ...\n"
cd /temp/yunpengn/calcite
git pull
@yunpengn
yunpengn / README.md
Last active May 20, 2024 06:57
A step-by-step guide to install PostgreSQL on Ubuntu without sudo privilege

Install PostgreSQL on Ubuntu without sudo

Being the most advanced open-source relational database, many of us need to install PostgreSQL for some purposes. However, sometimes you may not have sudo privilege on an Ubuntu server. Then, how should you install PostgreSQL in this case?

Compile from source!

Next, we will show a step-by-step guide on how to install PostgreSQL on Ubuntu by compiling it from source.

PostgreSQL Compilation & Installation

@yunpengn
yunpengn / dss.ri
Last active February 18, 2024 21:35
How to generate dataset using TPC-H
-- Sccsid: @(#)dss.ri 2.1.8.1
-- TPC-H Benchmark Version 8.0
-- For table REGION
ALTER TABLE REGION
ADD PRIMARY KEY (R_REGIONKEY);
-- For table NATION
ALTER TABLE NATION
ADD PRIMARY KEY (N_NATIONKEY);