Skip to content

Instantly share code, notes, and snippets.

Avatar
🐖

Fuxing Loh fuxingloh

🐖
View GitHub Profile
View defichain.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View bech32-defichain.txt
bcrt1qf5v8n3kfe6v5mharuvj0qnr7g74xnu9leut39r
bcrt1qnkmmcu79glheaqsq3gj4gg4675z3cjzn39dt24
bcrt1qrvt6c60848p8y8vd3pejdt33davp5ka9vxupuj
bcrt1qur2tmednr6e52u9du972nqvua60egwqkf98ps8
bcrt1qxvvp3tz5u8t90nwwjzsalha66zk9em95tgn3fk
bcrt1qdje7lynhsru5t9f2d8u6ckzsvmj8awq4m2qudx
bcrt1qj8wk7gzvaj6hyyupsj0hkuevg97lu23axlkjnm
bcrt1qqjrg9hkffz76fppvvlz5qulleagnhdkvde2xg2
bcrt1q7gqw25aac4k3um5v7n45tg08944nru29hkz9xc
bcrt1q2tke5fa7wx26m684d7yuyt85rvjl36u6q8l6e2
@fuxingloh
fuxingloh / Bip32Patch.test.ts
Created April 5, 2021 06:25
Bip32Path TypeScript
View Bip32Patch.test.ts
import { BIP32Path } from '../../src/utils/bip32_path'
describe('fromPathArray()', function () {
it('should work with proper input', function () {
const bipPath = BIP32Path.fromPathArray([44 | 0x80000000, 1, 1, 0])
expect(bipPath.toString()).toBe("m/44'/1/1/0")
})
})
describe('toPathArray()', function () {
@fuxingloh
fuxingloh / intellij-markdown.css
Created December 11, 2020 06:15
Ultra simple white theme markdown for IntelliJ
View intellij-markdown.css
body {
filter: invert(1);
background: #fff;
}
img {
filter: invert(1);
}
@fuxingloh
fuxingloh / lightsail.sh
Created September 21, 2020 09:19
Setup Docker & Docker-Compose on AWS Lightsail Amaozn Linux 2
View lightsail.sh
sudo yum install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo chkconfig docker on
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
@fuxingloh
fuxingloh / Data.java
Created April 17, 2020 07:36
Selectively Patch Data with Jackson ObjectMapper in Spring Web & Spring Data
View Data.java
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Entity
public class Data {
@NotNull
@Id
@Column(length = 255, updatable = false, nullable = false, unique = true)
private String id;
@fuxingloh
fuxingloh / SleepUtils.java
Created January 21, 2020 06:47
Thread.sleep with checked InterruptedException wrapped in unchecked.
View SleepUtils.java
package dev.fuxing.utils;
import java.time.Duration;
/**
* Created by: Fuxing
* Date: 20/8/18
* Time: 6:43 PM
*/
public final class SleepUtils {
@fuxingloh
fuxingloh / JsonUtils.java
Created January 21, 2020 06:46
JsonUtils is basically a singleton ObjectMapper that wraps all JSON Error into {@code JsonException}. There are also a bunch of helper method for parsing collections.
View JsonUtils.java
package dev.fuxing.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.type.CollectionType;
import com.fasterxml.jackson.databind.type.MapType;
import dev.fuxing.err.JsonException;
@fuxingloh
fuxingloh / Image.md
Last active October 14, 2021 01:08
A list of minimal effort image storage, transformation and delivery.
View Image.md

Minimal effort image storage, transformation and delivery.

IaaS

AWS: Serverless Image Handler

  • Storage: You upload to S3
  • Delivery + Transformation: CloudFront -> API Gateway -> Lambda (Node, Sharp/Thumbor) -> S3
  • CloudFormation: 1 click and fill up some fields.
  • Only predefined S3 Bucket, no dynamic bucket routing.
  • Transformation is encoded into Base64 that can be generated by anyone. You can add Signed URL but it's quite troublesome.
@fuxingloh
fuxingloh / ProceduralGenerationModification.md
Last active February 2, 2020 10:10
An idea on procedural content generation for games with alteration/grieving/modification.
View ProceduralGenerationModification.md

History

Basically the game No Man's Sky UPS was a world with infinite possibility. I was very excited about the release of such a game because it created new possibility in games and might even inspire some one to do it better. The game flopped on release but the concept was unique, I was excited of what's to come. Fast forward 3 years later, still very little innovation in such genre.

Two incident caught my attention recently, Minecraft 2b2t and Sky Citizen.

Minecraft 2b2t server is a good example of maintaining a world with infinite possibility. 4000 GB of data, and <100 players can be on it at a time.