Skip to content

Instantly share code, notes, and snippets.

Day Day Up

Nathanael Yang ny83427

Day Day Up
Block or report user

Report or block ny83427

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ny83427 /
Created Jan 22, 2019
Install Maven 3.6.0 at Ubuntu 14.04
sudo tar xf apache-maven-*.tar.gz -C /opt
sudo ln -s /opt/apache-maven-3.6.0 /opt/maven
sudo nano /etc/profile.d/
# commit these 4 lines
export JAVA_HOME=/usr/lib/jvm/default-java
export M2_HOME=/opt/maven
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
sudo chmod +x /etc/profile.d/
ny83427 /
Created Jan 18, 2019
Double Buffer Avoid Flashing
private Image bgImage;
public void update(Graphics g) {
if (bgImage == null) bgImage = this.createImage(WIDTH, HEIGHT);
Graphics bg = bgImage.getGraphics();
bg.fillRect(0, 0, WIDTH, HEIGHT);
ny83427 /
Created Jan 13, 2019
Play java audio file
* Initialize JFX toolkit if you are not running in JavaFX GUI environment
* It supports mp3, wav and is much easier to use
void cheer() {
PlatformImpl.startup(() -> {
Media hit = new Media(new File("audios/cheer.mp3").toURI().toString());
MediaPlayer mediaPlayer = new MediaPlayer(hit);;
ny83427 /
Last active Jan 7, 2019
Quick and dirty script to setup nexus at Ubuntu
# download 3.5.2-01 or latest version if you want: latest-unix.tar.gz
tar xvzf nexus-3.5.2-01-unix.tar.gz
# if you use latest-unix.tar.gz the extracted directory name might be different
cd nexus-3.5.2-01/bin
# start nexus in background and check status
./nexus start
./nexus status
# access http://localhost:8081 with admin/admin123
ny83427 /
Last active Dec 31, 2018
Leetcode Weekly Contest 117 Q1 and Q2 My Solution
import java.util.Stack;
public class TreeNode {
public int val;
public TreeNode left;
public TreeNode right;
public TreeNode(int x) {
val = x;
ny83427 / java-dev-env-cmd.bat
Last active Jan 11, 2019
Setup Java Development Environment Using Chocolatey
View java-dev-env-cmd.bat
@echo off
:: install Chocolatey, please make sure you are running cmd as administrator
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
:: install necessary components of Java development environment and some useful stuff
cinst intellijidea-community git jdk8 jdk11 vscode notepadplusplus eclipse netbeans-jse maven gradle everything f.lux -y
ny83427 / boxstarter-for-java-dev-env
Last active Dec 29, 2018
Setup SE500 development environment
View boxstarter-for-java-dev-env
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
cinst intellijidea-community
cinst jdk11
cinst jdk8
cinst git
cinst notepadplusplus
cinst vscode
cinst beyondcompare
You can’t perform that action at this time.