Skip to content

Instantly share code, notes, and snippets.

View linux-china's full-sized avatar

Libing Chen linux-china

View GitHub Profile
@linux-china
linux-china / graalvm.yml
Last active October 21, 2022 13:00
Github actions for GraalVM native image build on Windows, Mac and Linux. Please adjust 'demo-cli' to final name.
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: GraalVM Native Image build
on:
push:
branches: [ master ]
tags: [ '*' ]
@linux-china
linux-china / Cargo.toml
Created November 14, 2020 05:02
multipass shell completion
[package]
name = "multipass"
version = "0.1.0"
authors = ["linux_china <libing.chen@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "3.0.0-beta.2", features = ["yaml"] }
@linux-china
linux-china / multipass_completion.fish
Last active October 9, 2025 06:57
multipass shell completion for zsh & bash
complete -c multipass -n "__fish_use_subcommand" -s h -l help -d 'Prints help information'
complete -c multipass -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'
complete -c multipass -n "__fish_use_subcommand" -f -a "delete" -d 'Delete instances'
complete -c multipass -n "__fish_use_subcommand" -f -a "exec" -d 'Run a command on an instance'
complete -c multipass -n "__fish_use_subcommand" -f -a "find" -d 'Display available images to create instances from'
complete -c multipass -n "__fish_use_subcommand" -f -a "get" -d 'Get a configuration setting'
complete -c multipass -n "__fish_use_subcommand" -f -a "help" -d 'Display help about a command'
complete -c multipass -n "__fish_use_subcommand" -f -a "info" -d 'Display information about instances'
complete -c multipass -n "__fish_use_subcommand" -f -a "launch" -d 'Create and start an Ubuntu instance'
complete -c multipass -n "__fish_use_subcommand" -f -a "list" -d 'List all available instances'
@linux-china
linux-china / RSocketBrokerClient.java
Created September 25, 2020 00:04
Alibaba RSocket Broker Client jbang test script
//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.slf4j:slf4j-simple:1.7.30
//DEPS org.projectlombok:lombok:1.18.12
//DEPS com.alibaba.rsocket:alibaba-rsocket-core:1.0.0-SNAPSHOT
import com.alibaba.rsocket.encoding.JsonUtils;
import com.alibaba.rsocket.invocation.RSocketRemoteServiceBuilder;
import com.alibaba.rsocket.metadata.RSocketMimeType;
import com.alibaba.rsocket.upstream.UpstreamCluster;
import com.alibaba.rsocket.upstream.UpstreamManager;
@linux-china
linux-china / template.json
Created September 23, 2020 21:56
tgm template.json
{
"name": "spring-boot-java",
"repository": "https://github.com/tgm-templates/spring-boot-java",
"description": "Spring Boot App with Java",
"variables": [
{
"name": "groupId",
"description": "Maven groupId"
},
{
@linux-china
linux-china / Application.java
Last active September 25, 2020 03:14
Simple Spring Boot App
//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.springframework.boot:spring-boot-starter:2.3.4.RELEASE
package demo;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@linux-china
linux-china / cloudflare_kv_bindings.js
Last active August 26, 2020 20:49
CloudFlare KV JavaScript API with jsdoc support
/**
* cloudflare KV Namespace
*/
class KVNameSpace {
/**
* Write key-value pairs
* @param {string} key - key
* @param {(string|ArrayBuffer|ReadableStream)} value - value
* @param {{[expiration]: number, [expirationTtl]: number, [metadata]: {}}} [options] - putting options
* @return {Promise}
@linux-china
linux-china / wait.ts
Created May 25, 2020 17:56
wait for TypeScript
function wait(ms: number):Promise<undefined> {
return new Promise(resolve => setTimeout(resolve, ms));
}
await wait(1000);
@linux-china
linux-china / MemoryAppender.java
Last active July 28, 2021 20:08
Memory Appender for logback
/*
*
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
@linux-china
linux-china / welcome.ts
Created May 12, 2020 23:03
Welcome.ts for Deno
console.log("Welcome to Deno!")