Skip to content

Instantly share code, notes, and snippets.

View ZenLiuCN's full-sized avatar
🎯
Focusing

Zen Liu ZenLiuCN

🎯
Focusing
  • China Sichuan
View GitHub Profile
@ZenLiuCN
ZenLiuCN / dll2a
Created March 10, 2025 05:04
dll2a
#!/bin/sh
if [ $# -eq 0 ]; then
echo "ERROR:drop *.DLL file to script or pass as first argument"
exit 1
fi
dll_file="$1"
base_name=$(basename "$dll_file" .dll)
def_file="$base_name.def"
@ZenLiuCN
ZenLiuCN / func.js
Created January 21, 2025 16:04
functions
const Y=fn => (u => u(u))(x => fn((...args) => x(x)(...args)));
const factorial=Y(fa => n => n <= 1? 1: n * fa(n - 1));
@ZenLiuCN
ZenLiuCN / user.xml
Created January 11, 2025 07:15
IDEA SNAPSHOT
<templateSet group="user">
<template name="region" value="&lt;!--//region $END$ --&gt;&#10;$SELECTION$&#10;&lt;!--//endregion --&gt;" shortcut="ENTER" description="" toReformat="false" toShortenFQNames="true">
<context>
<option name="XML" value="true" />
</context>
</template>
<template name="fmtoff" value="//@formatter:off&#10;$SELECTION$&#10;//@formatter:on" description="" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_DECLARATION" value="true" />
<option name="JAVA_STATEMENT" value="true" />
@ZenLiuCN
ZenLiuCN / purge_mvn.bat
Created January 6, 2025 02:24
scripts for purge maven build caches (target folder)
@echo off
for /f "tokens=*" %%G in ('dir /b /s /a:d "classes*"') do del /Q /S %%G
for /f "tokens=*" %%G in ('dir /b /s /a:d "test-classes*"') do del /Q /S %%G
rem for clean full target folders
:: for /f "tokens=*" %%G in ('dir /b /s /a:d "test-classes*"') do del /Q /S %%G
@ZenLiuCN
ZenLiuCN / TreeCalcX.java
Last active December 28, 2024 06:48
tree caclulus implemant in java
package io.github.zenliucn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.IntFunction;
import java.util.function.Predicate;
@ZenLiuCN
ZenLiuCN / compile.java
Last active December 4, 2024 06:08
simple clojure eval
package sample;
import clojure.java.api.Clojure;
import clojure.lang.Compiler;
import clojure.lang.IFn;
import io.vertx.core.json.JsonObject;
import org.jooq.lambda.function.Function3;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@ZenLiuCN
ZenLiuCN / VertX.xml
Last active January 20, 2025 05:26
VertX templates
<templateSet group="VertX">
<template name="ieEntity" value="record $name$(&#10; Context ctx,&#10; io.vertx.sqlclient.SqlConnection tx,&#10; $ELE$X.DataJson data&#10;) implements Entities&lt;$ELE$, $ELE$X.DataJson, $name$&gt; {&#10; static $name$ of( Context ctx,&#10; io.vertx.sqlclient.SqlConnection tx,&#10; $ELE$X.DataJson data){&#10; return new $name$(ctx,tx,data);&#10; }&#10; static $name$ of( Context ctx,&#10; io.vertx.sqlclient.SqlConnection tx,&#10; $ELE$ data){&#10; return new $name$(ctx,tx,$ELE$X.fromAsJson(data));&#10; }&#10; @Override&#10; public $name$ $it() {&#10; return this;&#10; }&#10;&#10; @Override&#10; public java.util.function.Function&lt;$ELE$, $ELE$X.DataJson&gt; $toJson() {&#10; return $ELE$X::fromAsJson;&#10; }&#10;&#10; @Override&#10; public java.util.function.Function&lt;$ELE$X.DataJson, $name$&gt; $ctor() {&#10;
@ZenLiuCN
ZenLiuCN / protobuf.ts
Last active June 26, 2024 05:21
a brower only protobuf's buffer writer and reader, see protobuf.js for the orignal project (github.com/protobufjs/protobuf.js)
const charCodeAt = String.prototype.charCodeAt
const fromCharCode = String.fromCharCode;
export const MaxInt = 4294967296
export const utf8 = {
length(string) {
let len = 0,
c = 0;
Dim iFile(1 To 100000) As String
Dim count As Integer
Sub xls2xlsx()
iPath = "D:\Dev\project\jvm\pharmacy\Ã×ÄÚÍøÅÅÃû\"
On Error Resume Next
count = 0
zdir iPath
For i = 1 To count
If iFile(i) Like "*.xls" And iFile(i) <> ThisWorkbook.FullName Then
MyFile = iFile(i)

Licenses

#!/bin/sh

go install github.com/google/go-licenses@latest &&\
cd src &&\
go-licenses save "github.com/ZenLiuCN/loader" --save_path="../LICENSES"