Skip to content

Instantly share code, notes, and snippets.

View wxk6b1203's full-sized avatar

wxk6b1203

View GitHub Profile
@wxk6b1203
wxk6b1203 / Dockerfile
Created January 31, 2024 01:03
Dockerfile builds Node.js with ubuntu
FROM ubuntu:latest
LABEL maintainer="wxk6b1203 <xxx>"
# Default to UTF-8 file.encoding
ENV LANG en_US.UTF-8
RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
ENV NODE_VERSION 20.11.0
@wxk6b1203
wxk6b1203 / wg0.conf
Created November 26, 2023 03:57
Make your ECS which owns a public IP to be an router by Wireguard. Make sure change the keys and put it into /etc/wireguard/.
[Interface]
# self addresss
Address = 10.7.0.1/24
PrivateKey = AAAAA
# Important: IP table that allow to forward and MASQUERADE package.
# Before using this, make sure to set net.ipv4.ip_forward = 1 at /etc/sysctl.conf
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
# Any port firewall like iptables or firewalld allowd to access is okey.
ListenPort = 8881
@wxk6b1203
wxk6b1203 / Dockerfile
Created November 24, 2023 08:19
Dockerfile of oracle JDK. A binary package named jdk-xxx.tar.gz should be placed in the same directory.
FROM ubuntu:latest
LABEL maintainer="wxk6b1203 <xxx>"
# Default to UTF-8 file.encoding
ENV LANG en_US.UTF-8
# Example oracle jdk version, change it to your own one.
ENV JAVA_HOME=/jdk1.8.0_371
ADD jdk-8u*.tar.gz /
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
@wxk6b1203
wxk6b1203 / fabio.hcl
Created October 5, 2023 14:05
fabio nomad HCL configuration file
job "fabio" {
datacenters = ["dc1"]
type = "system"
group "fabio" {
network {
port "lb" {
static = 9999
}
port "ui" {
@wxk6b1203
wxk6b1203 / gitea.hcl
Created October 5, 2023 14:04
gitea deployment nomac hcl file
job "gitea" {
datacenters = ["dc1"]
type = "service"
group "gitea" {
count = 1
volume "gitea" {
type = "host"
read_only = false
@wxk6b1203
wxk6b1203 / main.go
Created February 6, 2023 15:27
Golang get struct fields
package main
import "fmt"
func GetStructTags(s interface{}, tag string) map[string]string {
t := reflect.TypeOf(s)
if t.Kind() == reflect.Ptr {
t = t.Elem()
}
@wxk6b1203
wxk6b1203 / test.vue
Created October 9, 2020 18:59
Vue 3.0.0 qiz reproduction of "Boolean to default false"
<template>
<a-modal v-model:visible="onShow"> </a-modal>
</template>
<script lang="ts">
// import { Options, Vue } from "vue-class-component";
// @Options({
// props: {
// show: Boolean,
@wxk6b1203
wxk6b1203 / mac_like_hotkey.ahk
Last active November 2, 2023 11:02
CapsLock2CtrlSpace
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;SetCapsLockState, AlwaysOff
CapsLock::
If (StartTime)