Skip to content

Instantly share code, notes, and snippets.

View enpitsuLin's full-sized avatar
🐣
keep young, keep naive

Ming Lin enpitsuLin

🐣
keep young, keep naive
View GitHub Profile
@enpitsuLin
enpitsuLin / index.md
Created August 2, 2023 02:23
export wsl images
# check name
wsl --list -v
wsl --export ${NAME_FROM_LIST} "D:\\Whereever"
# unregister it which will totally remove your file
wsl --unregister ${NAME_FROM_LIST}
🥇 六等星の夜 - Aimer
🥈 你不是真正的快樂 - Mayday
🥉 Lemon - Kenshi Yonezu
aLIEz - SawanoHiroyuki[nZ
ピースサイン - Kenshi Yonezu
打上花火 - Daoko & Kenshi Yo
/**
* expend version of van-js v0.11.10
* just for study
* @copyright Tao xin
* @link https://github.com/jorgebucaran/hyperapp
*/
import { BindFunc, ChildDom, DerivedProp, Primitive, Props, State, StateView, TagFunc, default as Van } from "./van"
// This file consistently uses `let` keyword instead of `const` for reducing the bundle size.
import { colors } from 'unocss/preset-mini'
const excludedColor = ['inherit', 'current', 'transparent', 'lightblue', 'lightBlue', 'warmgray', 'warmGray', 'truegray', 'trueGray', 'coolgray', 'coolGray', 'bluegray', 'blueGray']
const colorsRegexp = new RegExp(`theme\:(\\w+-)(${Object.keys(colors).filter(c => !excludedColor.includes(c)).join('|')})[-]?(\w+)?`, 'g')
const colorValueList = ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900', '950']
function transformerThemeColor(): SourceCodeTransformer {
return {
name: "transformer-theme-color",
@enpitsuLin
enpitsuLin / xLog.css
Last active February 27, 2024 03:41
My xLog theme
html {
--theme-color: #4f46e5;
}
html.dark {
--theme-color: #818cf8;
}
:root {
--sidebar-width: 20rem;
# === NPM BINARY CHINA ===
# https://github.com/cnpm/binary-mirror-config/blob/master/package.json#L53
$env:NODEJS_ORG_MIRROR="https://cdn.npmmirror.com/binaries/node"
$env:NVM_NODEJS_ORG_MIRROR="https://cdn.npmmirror.com/binaries/node"
$env:PHANTOMJS_CDNURL="https://cdn.npmmirror.com/binaries/phantomjs"
$env:CHROMEDRIVER_CDNURL="https://cdn.npmmirror.com/binaries/chromedriver"
$env:OPERADRIVER_CDNURL="https://cdn.npmmirror.com/binaries/operadriver"
$env:ELECTRON_MIRROR="https://cdn.npmmirror.com/binaries/electron/"
$env:ELECTRON_BUILDER_BINARIES_MIRROR="https://cdn.npmmirror.com/binaries/electron-builder-binaries/"
$env:SASS_BINARY_SITE="https://cdn.npmmirror.com/binaries/node-sass"
@enpitsuLin
enpitsuLin / useTheme.ts
Last active February 16, 2023 02:51
some solid hooks
import { createContext, createEffect, ParentProps, useContext } from 'solid-js'
import { createStore, SetStoreFunction } from 'solid-js/store'
import { isServer } from 'solid-js/web'
type Theme = 'light' | 'dark'
function initialTheme() {
if (typeof localStorage === 'undefined') return 'system'
return localStorage.getItem('theme') as 'light' | 'dark' | 'system'
}
@enpitsuLin
enpitsuLin / main.js
Last active April 26, 2023 01:30
get all css variable from :root
/*
const list = Array.from(document.styleSheets)
.filter((sheet) => sheet.href === null || sheet.href.startsWith(window.location.origin))
.reduce(
(acc, sheet) => [ //lower performance for this way
...acc,
...Array.from(sheet.cssRules).reduce(
(def, rule) =>
(def =
rule.selectorText === ':root'
$WSLADDRESS = wsl -- ip -o -4 -json addr list eth0 | ConvertFrom-Json | ForEach-Object { $_.addr_info.local } | Where-Object { $_ }
#[Ports]
$PORTS = $args;
#[Static ip]
$LISTENADDRESS = '0.0.0.0';
$PORTS_STR = $PORTS -join ",";
# see what terrible and stupid thing I just did (openssl 1.0.2-k to 1.1.0.e without updating everything else)
tail /var/log/pacman.log
# remove the newly installed openssl files by listing all the files in the packages tar and removing them (taking care not to rm directories)
tar -tf /var/cache/pacman/pkg/openssl-1.1.0.e-1-x86_64.pkg.tar.xz | #list all the files
sed s:^:/:| # put the leading / on all entries
grep -v /$ | # remove folders from list (skip if it ends with /)
xargs rm # remove all the files
# go to root and extract the old package -- like nothing ever happend