Skip to content

Instantly share code, notes, and snippets.

FROM bellsoft/liberica-openjdk-alpine-musl:21
# RUN rm -f /etc/apk/repositories \
# && echo "http://mirrors.ustc.edu.cn/alpine/v3.18/main/" >> /etc/apk/repositories \
# && echo "http://mirrors.ustc.edu.cn/alpine/v3.18/community/" >> /etc/apk/repositories
# add tzdata
RUN apk add --no-cache tzdata \
fontconfig ttf-dejavu \
&& rm -rf /var/cache/apk/*
@liyuntao
liyuntao / NeedSign.java
Created December 7, 2020 07:33 — forked from la3rence/NeedSign.java
利用注解和切面给接口做签名验证(SpringBoot)
package com.example.open.server.aop;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 请在需要签名的接口上打上此注解
*
@liyuntao
liyuntao / CheckSharedMount.java
Last active May 15, 2020 07:58
check sharedVolume mounted on startup
public class Starter {
Logger log = LoggerFactory.getLogger(Starter.class);
/**
* 服务启动方法
*/
public static void main(String[] args) {
SpringApplication app = new SpringApplication();
app.addListeners(new CheckSharedMount());
@liyuntao
liyuntao / fuckoff.command
Created February 29, 2020 08:05
The reason of creating this script is that Endpoint Security VPN installs it's own application firewall kext cpfw.kext which prevents for example PPTP connections from this computer, which is not appropriate if you need subj connection just from time to time.
#!/bin/bash
#
# The reason of creating this script is that Endpoint Security VPN installs it's own application firewall kext cpfw.kext
# which prevents for example PPTP connections from this computer, which is not appropriate if you need subj connection just
# from time to time
#
# Usage: put the file anywhere, remember `chmod u+x fuckoff.command`
# So you can call the script from e.g. `spotlight` or by doubleclick.
#
# Typing `fuckoff` in spotlight with your anger then hit Enter.
@liyuntao
liyuntao / 1_kubernetes_on_macOS.md
Created August 7, 2019 11:42 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@liyuntao
liyuntao / index.html
Created August 28, 2018 02:11
particles.js
<!-- particles.js container -->
<div id="particles-js"></div>
<!-- stats - count particles -->
<div class="count-particles">
<span class="js-count-particles">--</span> particles
</div>
<!-- particles.js lib (JavaScript CodePen settings): https://github.com/VincentGarreau/particles.js -->
@liyuntao
liyuntao / README.md
Created August 13, 2018 16:13 — forked from superseb/README.md
Deploy kubernetes-dashboard on Rancher 2.0 cluster exposed using NodePort

Deploy kubernetes-dashboard on Rancher 2.0 cluster exposed using NodePort

Requirements

Step 1: Generate kubeconfig from the UI

Generate the kubeconfig file for your cluster using the Kubeconfig File button in the Cluster view of your cluster. Save the generated file as $HOME/.kube/config and run kubectl get nodes to verify it works.

@liyuntao
liyuntao / random.kt
Created July 30, 2018 13:37
get a random number in Kotlin
fun ClosedRange<Int>.random() =
Random().nextInt((endInclusive + 1) - start) + start
// usage
(0..10).random()
(0 until 10).random()
@liyuntao
liyuntao / VisualisationMetricHandler.kt
Created April 15, 2018 02:58
first tmp version for Promviz
const val UPSTREAM_SERVICE_NAME_HEADER = "x-client-name"
class VisualisationMetricHandler : Handler<RoutingContext> {
val httpGauge = Gauge.build()
.name("status:http_requests_total:rate5m")
.help("Requests per 5m")
.labelNames("service", "client", "status")
.register()
@liyuntao
liyuntao / TcpDiscoveryRancherIpFinder.java
Created March 17, 2018 16:24
Apache Ignite discovery for Rancher
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;