Skip to content

Instantly share code, notes, and snippets.

View lovelock's full-sized avatar
🏠
Working from home

Frost Wong lovelock

🏠
Working from home
  • http://www.weibo.com
  • Beijing, China
View GitHub Profile
@lovelock
lovelock / k6-script.js
Last active February 29, 2024 06:29
k6 scripts
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
// A number specifying the number of VUs to run concurrently.
vus: 6,
// A string specifying the total duration of the test run.
duration: '10s',
summaryTrendStats: ['avg','min','med','max','p(90)','p(95)','p(99)','p(99.9)','p(99.99)'],
@lovelock
lovelock / config.el
Created February 1, 2023 06:09
解决emacs gui模式中文展示难看的问题
(defun +my/better-font()
(interactive)
;; english font
(if (display-graphic-p)
(progn
(set-face-attribute 'default nil :font (format "%s:pixelsize=%d" "Fira Code" 17)) ;; 11 13 17 19 23
;; chinese font
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font)
charset
@lovelock
lovelock / install-latest-squirrel.sh
Created January 31, 2023 15:39
install latest squirrel input method
#!/usr/bin/env bash
SQUIRREL_DIR=$(PWD)/squirrel
LIBRIME_DIR=${SQUIRREL_DIR}/librime
if [ ! -d ${SQUIRREL_DIR} ]; then
git clone --recursive https://github.com/rime/squirrel.git ${SQUIRREL_DIR}
else
git -C ${SQUIRREL_DIR} pull origin master
@lovelock
lovelock / squirrel.custom.yaml
Created January 17, 2023 10:35
最像macOS默认输入法的皮肤方案
author: "lamb"
name: "lamb"
back_color: 0xffffff # 候选条背景色,24位色值,16进制,BGR顺序
border_color: 0xffffff # 边框色
text_color: 0x333333 # 拼音行文字颜色
hilited_back_color: 0xD75A00 # 第一候选项背景背景色
hilited_candidate_text_color: 0xFFFFFF # 第一候选项文字颜色
hilited_candidate_label_color: 0xFFFFFF # 第一候选项编号颜色
hilited_comment_text_color: 0xD05B21 # 注解文字高亮
hilited_text_color: 0xffffff # 高亮拼音 (需要开启内嵌编码)
@lovelock
lovelock / SimpleHTTPServerWithUpload.py
Created July 6, 2022 07:36 — forked from amdei/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
__version__ = "0.1"
__all__ = ["SimpleHTTPRequestHandler"]
# migrating from https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git/git.plugin.zsh
# Aliases
alias g='git'
#compdef g=git
alias gst='git status'
#compdef _git gst=git-status
alias gd='git diff'
#compdef _git gd=git-diff
alias gdc='git diff --cached'
@lovelock
lovelock / CompletableFutureTest.java
Created February 8, 2021 14:19
一个将要改写成并发程序的demo
package fun.happyhacker;
import lombok.Data;
import org.apache.commons.codec.digest.DigestUtils;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* @author Frost Wong <[email protected]>
@lovelock
lovelock / log4j2.xml
Last active February 22, 2021 07:55
default log4j2 configuration
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console"/>
@lovelock
lovelock / left-ctrl-hjkf.json
Created August 3, 2020 01:06
HHKB key modificaton for Karabiner-elelments
{
"title": "Left ctrl + hjkf to Arrow Keys Vim",
"rules": [
{
"description": "Left ctrl + hjkf to arrow keys Vim",
"manipulators": [
{
"from": {
"key_code": "h",
"modifiers": {
@lovelock
lovelock / DailyRollingWithMaxBackupIndexFileAppender.java
Last active September 21, 2023 01:07
Daily rolling file appender for log4j with maxBackupIndex
package fun.happyhacker;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Layout;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.spi.LoggingEvent;
import java.io.File;
import java.io.IOException;
import java.io.InterruptedIOException;