Skip to content

Instantly share code, notes, and snippets.

Avatar

Haowei Wen yushijinhun

View GitHub Profile
@yushijinhun
yushijinhun / lxd-resolve-domain.md
Created Apr 29, 2021
[LXD] Resolve .lxd domains
View lxd-resolve-domain.md

Steps

Check your host IP address on LXD network interface:

$ lxc network show lxdbr0
config:
  ipv4.address: 172.17.233.1/24 # <--- IP address is 172.17.233.1
...

Edit /etc/systemd/resolved.conf.d/lxdbr0.conf:

@yushijinhun
yushijinhun / lxd-forward-desktop.md
Last active Apr 24, 2021
[LXD] Forward X11 & Wayland to container
View lxd-forward-desktop.md

Steps

First, create a LXD profile named forward-desktop:

lxc profile create forward-desktop

Edit the profile:

lxc profile forward-desktop

Replace config: {} and devices: {} with:

View gpg_cheatsheet.md
@yushijinhun
yushijinhun / enable-preview.gradle
Last active Dec 19, 2019
[gradle]enable java preview features
View enable-preview.gradle
// - Adds '--enable-preview' parameter
application {
applicationDefaultJvmArgs << '--enable-preview'
}
compileJava {
options.compilerArgs << '--enable-preview'
}
@yushijinhun
yushijinhun / eclipse-modularity.gradle
Last active Dec 19, 2019
[gradle|jpms|eclipse|buildship] Add modularity support to Buildship
View eclipse-modularity.gradle
// - Adds modularity support to Buildship
// Code is originally from https://github.com/java9-modularity/gradle-modules-plugin/issues/33#issue-376998502
apply plugin: 'eclipse'
eclipse {
classpath {
file {
whenMerged {
@yushijinhun
yushijinhun / download-minecraft-skin.sh
Last active Dec 19, 2019
[shell]Download Minecraft skin
View download-minecraft-skin.sh
#!/bin/bash
name=$1
wget -O - $(curl --silent https://sessionserver.mojang.com/session/minecraft/profile/$(curl --silent -X POST -H 'Content-Type: application/json' --data "[\"$name\"]" https://api.mojang.com/profiles/minecraft|grep -Po '"id"\s*:\s*"\K[^"]+')|grep -Po '"value"\s*:\s*"\K[^"]+'|base64 -d|grep -Po '"SKIN"\s*:\s*{\s*"url"\s*:\s*"\K[^"]+')
@yushijinhun
yushijinhun / minecraft-offline-uuid.php
Created Jul 8, 2018 — forked from games647/minecraft-offline-uuid.php
Generate an offline minecraft UUID v3 based on the case sensitive player name
View minecraft-offline-uuid.php
<?
/**
* Generates a offline-mode player UUID.
*
* @param $username string
* @return string
*/
public static function constructOfflinePlayerUuid($username) {
//extracted from the java code:
//new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name));
@yushijinhun
yushijinhun / !jdk-8203870.md
Last active Dec 19, 2019
[JDK-8203870]OpenJDK FXML Read-Only List Properties Bug
View !jdk-8203870.md

Issue in JDK Bug System: JDK-8203870


Expected output:

listProp: [elementA, elementB]
Problem did not appear
View keybase.md

Keybase has been acquired by Zoom, therefore you should NEVER blindly trust the information it provides!

Keybase proof

I hereby claim:

  • I am yushijinhun on github.
  • I am was yushijinhun (https://keybase.io/yushijinhun) on keybase.
  • I have a public key whose fingerprint is 9AF5 443C 95BB 317A 10ED 6B99 5BC1 67F7 3EA5 58E4
@yushijinhun
yushijinhun / Dockerfile
Created Jul 31, 2017
[ubuntu|docker]auto select fastest apt mirror
View Dockerfile
FROM ubuntu
RUN apt-get update -y \
&& apt-get install -y wget \
&& wget -O netselect.deb http://http.us.debian.org/debian/pool/main/n/netselect/netselect_0.3.ds1-28+b1_`dpkg --print-architecture`.deb \
&& dpkg -i netselect.deb \
&& rm netselect.deb \
&& sed -r -i -e "s#http://(archive|security)\.ubuntu\.com/ubuntu/?#$(netselect -v -s1 -t20 `wget -q -O- https://launchpad.net/ubuntu/+archivemirrors | grep -P -B8 "statusUP|statusSIX" | grep -o -P "http://[^\"]*"`|grep -P -o 'http://.+$')#g" /etc/apt/sources.list