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 / imdb_setup_ftp.sh
Last active February 6, 2020 10:33
A simple script to setup IMDb movie database
printf "Program starts at %s.\n" "$(date)"
printf "Going to clean and create new folder ...\n"
rm -rf imdb-datasets-ftp/ imdb-queries/
mkdir imdb-datasets-ftp/
printf "Going to download datasets from FTP server ...\n"
wget http://homepages.cwi.nl/~boncz/job/imdb.tgz
tar -xvzf imdb.tgz -C imdb-datasets-ftp/
rm -f imdb.tgz
@yunpengn
yunpengn / papertrail.md
Last active March 15, 2020 05:13
Instructions for setting up Papertrail client on Linux

Follow the steps below:

  • Download the latest remote_syslog2 client.
  • Unzip the file by tar -xvzf remote_syslog_linux_amd64.tar.gz.
  • Modify the configuration inside example_config.yml. It should be ideally something similar as:
files:
  - path: app.log
 tag: app_name