This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Black=0,0,0 | |
BoldBlack=64,64,64 | |
Red=204,0,0 | |
BoldRed=239,41,41 | |
Green=78,154,6 | |
BoldGreen=138,226,52 | |
Yellow=196,160,0 | |
BoldYellow=252,233,79 | |
Blue=52,101,164 | |
BoldBlue=114,159,207 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Sync system time from various network APIs | |
[Service] | |
User=root | |
Type=oneshot | |
ExecStart=/usr/local/lib/time-sync.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USERNAME='rocka' | |
HOSTNAME='arch' | |
SS_PORTNO='1234' | |
SS_METHOD='aes-256-gcm' | |
SS_PASSWD='all-your-base-are-belong-to-us' | |
# pacman related config | |
sed -i 's/#Color/Color/g' /etc/pacman.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { open } from 'node:fs/promises'; | |
import readline from 'node:readline'; | |
const segmenter = new Intl.Segmenter('zh-CN', { granularity: 'grapheme' }); | |
const file = await open('./dict_sc.txt'); | |
const rl = readline.createInterface({ | |
input: file.createReadStream(), | |
crlfDelay: Infinity // \r followed by \n will always be considered a single newline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ref: https://stackoverflow.com/questions/13283649/android-jni-local-reference-table-dump-current-state | |
fun dumpReferenceTables() { | |
try { | |
Class.forName("dalvik/system/VMDebug").run { | |
val dumpReferenceTables = getDeclaredMethod("dumpReferenceTables") | |
val constructor = getDeclaredConstructor() | |
constructor.isAccessible = true | |
dumpReferenceTables.invoke(constructor.newInstance()) | |
} | |
} catch (e: Exception) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
index 38090ea..2301442 100644 | |
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -8,10 +8,10 @@ include(GNUInstallDirs) | |
include(ECMSetupVersion) | |
include(ECMUninstallTarget) | |
-find_package(Fcitx5Core 5.0.4 REQUIRED) | |
-find_package(Fcitx5Module REQUIRED COMPONENTS Notifications QuickPhrase Spell Clipboard TestFrontend TestIM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Twitter remove t.co | |
// @description replace t.co with original links | |
// @match https://twitter.com/* | |
// @version 0.1 | |
// ==/UserScript== | |
const PRIMARY_COLUMN = '[data-testid="primaryColumn"]'; | |
const SIDEBAR_COLUMN = '[data-testid="sidebarColumn"]'; | |
const A_HREF_T_CO = 'a[href^="https://t.co"]'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun copyFileOrDir(path: String) { | |
val assetManager = this.assets | |
try { | |
val assets = assetManager.list(path) | |
if (assets!!.isEmpty()) { | |
copyFile(path) | |
} else { | |
val dir = File("${applicationInfo.dataDir}/${path}") | |
if (!dir.exists()) dir.mkdir() | |
for (i in assets.indices) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
msg() { | |
# green | |
echo -e "\e[32m==>\e[0m" "\e[1m$@\e[0m" | |
} | |
msg2() { | |
# blue | |
echo -e "\e[34m ->\e[0m" "\e[1m$@\e[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docker helper functions for fish shell | |
function docker-update --description 'pull all :latest images' | |
docker images --format '{{.Repository}}:{{.Tag}}' | egrep ':(latest|alpine)' | xargs -L1 docker pull | |
end | |
function docker-clean --description 'remove all none-taged images' | |
docker rmi (docker images | grep '<none>' | awk '{print $3}') | |
end |
NewerOlder