Skip to content

Instantly share code, notes, and snippets.

View hungtcs's full-sized avatar

鸿则 hungtcs

View GitHub Profile
@hungtcs
hungtcs / tooltip-formatter.ts
Created July 22, 2019 10:00
echarts tooltip formatter function with unit supported
import { EChartOption } from 'echarts';
declare interface _Format extends EChartOption.Tooltip.Format {
marker: string;
axisValueLabel: string;
}
const formatter: EChartOption.Tooltip.Formatter = function(params: _Format|Array<_Format>, _ticket, _callback) {
if(params instanceof Array) {
if(params.length) {
@hungtcs
hungtcs / steam-helper.user.js
Last active April 11, 2020 06:49
根据app-id直接添加游戏到愿望单
// ==UserScript==
// @name Steam Helper
// @namespace http://tampermonkey.net/
// @version 0.1
// @description steam额外帮助工具
// @author 鸿则<hungtcs@163.com>
// @match https://store.steampowered.com/*
// @grant none
// ==/UserScript==
@hungtcs
hungtcs / search-engine-switcher.user.js
Last active November 18, 2020 00:17
搜索引擎快速切换器
// ==UserScript==
// @name Search Engine Switcher
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 提供更方便的方式切换搜索引擎,快捷键 Alt+S
// @author 鸿则<hungtcs@163.com>
// @match https://www.google.com/*
// @match https://www.baidu.com/*
// @match https://*.bing.com/*
// @match https://www.google.com/search*
@hungtcs
hungtcs / DESUtils.java
Last active May 7, 2020 05:43
CryptoJS 与 Java 互通的 DES 与 Triple DES 加密解密工具
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import java.security.SecureRandom;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.SecretKeyFactory;
/**
* DES 加密解密工具
* @author 鸿则<hungtcs@163.com>
@hungtcs
hungtcs / buildin-display.sh
Created October 18, 2020 12:55
enable or disable build-in display by shell function
#!/usr/bin/env bash
buildin_display_name=eDP-1-1
displays=($(xrandr | grep " connected " | awk '{ print$1 }'))
display_count=${#displays[@]}
function enable-buildin-display() {
if [ $display_count -gt 1 ]; then
echo "disable buildin display: ${buildin_display_name}";
xrandr --output "$buildin_display_name" --auto
@hungtcs
hungtcs / sclipboard.sh
Created November 9, 2020 02:52
Linux Shell Software Clipboard
#!/usr/bin/env bash
CONFIG_FOLDER=~/.config/scopy-paste
CONFIG_FILE="$CONFIG_FOLDER/value"
if [ ! -d "$CONFIG_FOLDER" ]; then
mkdir -p "$CONFIG_FOLDER";
fi
function scopy() {
@hungtcs
hungtcs / change-github-font-family.user.js
Last active December 18, 2020 15:28
Change Github Font Family
// ==UserScript==
// @name Change Github Font Family
// @name:zh-CN Github网站字体切换
// @icon https://github.githubassets.com/favicons/favicon.png
// @version 0.0.3
// @description custom github font family
// @description:zh-CN 切换Github等网站的字体
// @namespace https://gist.github.com/hungtcs
// @author 鸿则<hungtcs@outlook.com>
// @homepage https://gist.github.com/hungtcs/819a64fa9e6bfa37ce391f29765acfa3
@hungtcs
hungtcs / sample.sh
Last active December 22, 2023 06:26
ffmpeg 录制屏幕
# Linux:录制当前显示器
# - show_region: 显示录制区域
# - framerate: 录制的帧率
# - video_size: 录制区域的大小
# - $DISPLAY+0,0: `$DISPLAY`:环境变量,当前显示器
# `+0,0` 录制区域偏移量
# x11grab: http://underpop.online.fr/f/ffmpeg/help/x11grab.htm.gz
ffmpeg -f x11grab -show_region 1 -framerate 8 -video_size 1024x768 -i $DISPLAY+0,0 -y output.mp4
# MacOS 录制屏幕
@hungtcs
hungtcs / 重要步骤.md
Last active February 20, 2022 10:23
Raspberry Pi 3B install Lakka

重要步骤

中文UI

  1. 上传字体到 /storage/assets/xmb/retroactive/font.ttf
  2. systemctl stop retroarch
  3. vim ~/.config/retroarch/retroarch.cfg
  4. change video_font_path = /storage/assets/xmb/retroactive/font.ttf
  5. systemctl start retroarch
@hungtcs
hungtcs / examples.ts
Last active October 25, 2023 03:13
Simple JavaScript Sandbox
const parser = Sandbox.compile('a + b');
const result = parser({ a: 1, b: 2 });
// ---
const parser = Sandbox.compile('a + b + alert', { throwOnUndefined: true });
const result = parser({ a: 1, b: 2 });