Skip to content

Instantly share code, notes, and snippets.

Avatar
JUST DO IT

Nathanael Yang ny83427

JUST DO IT
View GitHub Profile
@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
@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 / 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 / install-nexus.sh
Last active Mar 25, 2020
Quick and dirty script to setup nexus at Ubuntu
View install-nexus.sh
# download 3.21.2-03 or latest version if you want: latest-unix.tar.gz
wget https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.21.2-03-unix.tar.gz
tar xvzf nexus-3.21.2-03-unix.tar.gz
# if you use latest-unix.tar.gz the extracted directory name might be different
cd nexus-3.21.2-03/bin
# start nexus in background and check status
./nexus start
./nexus status
# access http://localhost:8081 with admin/admin123
@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 / 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 / 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 / inst-oracle-jdk13-ubuntu.sh
Created Feb 25, 2020
install-oracle-jdk13-ubuntu
View inst-oracle-jdk13-ubuntu.sh
# auto accept oracle license agreement
echo oracle-java13-installer shared/accepted-oracle-license-v1-2 select true | sudo /usr/bin/debconf-set-selections
# install oracle jdk13 and set environment variables
sudo add-apt-repository ppa:linuxuprising/java -y
sudo apt-get update
sudo apt-get install oracle-java13-installer -yq
sudo apt-get install oracle-java13-set-default -yq
# set JAVA_HOME variable and link jdk13 to default location also
You can’t perform that action at this time.