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
ny83427 / inst-maven-3.6.0.sh
Created Jan 22, 2019
Install Maven 3.6.0 at Ubuntu 14.04
View inst-maven-3.6.0.sh
wget https://www-us.apache.org/dist/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz
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/maven.sh
# 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/maven.sh
@ny83427
ny83427 / Sample.java
Created Jan 18, 2019
Double Buffer Avoid Flashing
View Sample.java
private Image bgImage;
@Override
public void update(Graphics g) {
if (bgImage == null) bgImage = this.createImage(WIDTH, HEIGHT);
Graphics bg = bgImage.getGraphics();
bg.setColor(Color.BLACK);
bg.fillRect(0, 0, WIDTH, HEIGHT);
this.paintComponent(bg);
}
@ny83427
ny83427 / Audience.java
Created Jan 13, 2019
Play java audio file
View Audience.java
/**
* 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);
mediaPlayer.play();
});
@ny83427
ny83427 / install-nexus.sh
Last active Jan 7, 2019
Quick and dirty script to setup nexus at Ubuntu
View install-nexus.sh
# download 3.5.2-01 or latest version if you want: latest-unix.tar.gz
wget https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.5.2-01-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
ny83427 / TreeNode.java
Last active Dec 31, 2018
Leetcode Weekly Contest 117 Q1 and Q2 My Solution
View TreeNode.java
import java.util.Stack;
public class TreeNode {
public int val;
public TreeNode left;
public TreeNode right;
public TreeNode(int x) {
val = x;
}
@ny83427
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('https://chocolatey.org/install.ps1'))" && 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
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
Enable-RemoteDesktop
cinst intellijidea-community
cinst jdk11
cinst jdk8
cinst git
cinst notepadplusplus
cinst vscode
cinst beyondcompare
You can’t perform that action at this time.