Skip to content

Instantly share code, notes, and snippets.

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

enpitsulin enpitsuLin

🐣
keep young, keep naive
View GitHub Profile
@enpitsuLin
enpitsuLin / 📊 Weekly development breakdown
Last active January 14, 2024 00:55
Weekly development breakdown
TypeScript 14 hrs 49 mins ██████████████▉░░░░░░ 71.3%
JavaScript 2 hrs 56 mins ██▉░░░░░░░░░░░░░░░░░░ 14.2%
Other 1 hr 3 mins █░░░░░░░░░░░░░░░░░░░░ 5.1%
JSON 59 mins █░░░░░░░░░░░░░░░░░░░░ 4.8%
Diff 36 mins ▌░░░░░░░░░░░░░░░░░░░░ 2.9%
@enpitsuLin
enpitsuLin / gatsby-node.js
Last active October 28, 2021 14:49
gatsby alias
exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
resolve: {
alias: {
// alias like webpack configuration
'@': path.join(__dirname, './src')
}
}
});
};
@enpitsuLin
enpitsuLin / 🎵 My last week in music
Last active May 23, 2023 01:22
🎵 My last week in music
🥇 生生世世爱 - 吴雨霏 · 0 plays
🥈 Cage - Tielle/SawanoHiroyuki[nZk] · 0 plays
🥉 ┇Stranger┇唯死以解脱(《仅七人》授权OST)(翻自 Ali) - STRANGER_BTS/大桐咂/佛痛丶 · 0 plays
光年之外 - G.E.M.邓紫棋 · 0 plays
カタオモイ - Aimer · 0 plays

Keybase proof

I hereby claim:

  • I am enpitsuLin on github.
  • I am enpitsulin (https://keybase.io/enpitsulin) on keybase.
  • I have a public key whose fingerprint is 0672 CB81 76D0 9B46 A823 B81C 85C8 36DC 516B 372C

To claim this, I am signing this object:

const arr = [new Date(), new RegExp(''), new String('test'), 'test', /test/, new Number(1), 1, BigInt(1), 1n]
type InferConstructorType<C> = C extends DateConstructor ? Date : C extends ((...args: any[]) => infer T) | (new (...args: any[]) => infer T) ?
T : unknown
function filterInstance<Constructor extends ((...args: any[]) => any) | (new (...args: any[]) => any)>(
t: Constructor
) {
return (item: any, _index: number, _arr: any[]): item is InferConstructorType<Constructor> => {
if (typeof item === 'object') {
# enable run remote script
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Scoop configruation
$env:SCOOP = 'E:\scoop' # custom scoop install dir
$env:SCOOP_GLOBAL = 'E:\scoop\apps' # custom scoop app install dir
[environment]::setEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')
[environment]::setEnvironmentVariable('SCOOP', $env:SCOOP, 'User')
Invoke-WebRequest -useb get.scoop.sh | Invoke-Expression
type Theme = 'system' | 'dark' | 'light'
export default function useTheme() {
const [theme, setTheme] = useState<Theme>(() => {
if (typeof localStorage === 'undefined') return 'system'
return (localStorage.getItem('theme') as Theme) || 'system'
})
useEffect(() => {
const root = document.documentElement
# 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
$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 ",";