Skip to content

Instantly share code, notes, and snippets.

@pallove
pallove / scand.go
Last active November 9, 2018 03:31
walk directory with filetype filter
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
"strings"
)
@pallove
pallove / HoldToQuit.spoon.lua
Last active May 24, 2022 14:42
improve the spoon(HoldToQuit) of hammerspoon, the behaviour like Google Chrome`s
--- === HoldToQuit ===
---
--- Instead of pressing ⌘Q, hold ⌘Q to close applications.
local obj = {}
obj.__index = obj
-- Metadata
obj.name = "HoldToQuit"
obj.version = "1.1"
@pallove
pallove / poemnet-workflow.go
Created November 21, 2021 11:29
an alfredworkflow suggestion about gushiwen.cn
package main
import (
"encoding/json"
"fmt"
"html"
"log"
"net/http"
"os"
"strings"
@pallove
pallove / Fn_keys_for_app.lua
Last active January 4, 2022 01:02
because the vscode use Fn keys(debug, rename, Go to...), and the karabiner is so heavy, so i do some work on Hammerspoon.
--- place the snippets in your ~/.hammerspoon/init.lua
local sys_key = {
[3] = {pos = 1, key = 'F1'}, -- BRIGHTNESS_DOWN
[2] = {pos = 2, key = 'F2'}, -- BRIGHTNESS_UP
[22] = {pos = 5, key = 'F5'}, -- ILLUMINATION_DOWN
[21] = {pos = 6, key = 'F6'}, -- ILLUMINATION_UP
[20] = {pos = 7, key = 'F7'}, -- REWIND
[16] = {pos = 8, key = 'F8'}, -- PLAY
[14] = {pos = 9, key = 'F9'}, -- FAST
@pallove
pallove / Token.sol
Created March 2, 2022 01:12
a solidity ERC20 smart contract with fees (marking, burn, ect)
/**
* Submitted for verification at BscScan.com on 2022-02-24
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
@pallove
pallove / isProxy.js
Created December 10, 2023 06:47
check whether javascript object is a proxy
const isProxy = obj => {
try {
let test = {obj : true}
test[obj] = false
} catch {
return true
}
return false
}