Skip to content

Instantly share code, notes, and snippets.

View merrickluo's full-sized avatar
💭
I may be slow to respond.

Merrick Luo merrickluo

💭
I may be slow to respond.
View GitHub Profile
@merrickluo
merrickluo / proxy.sh
Last active March 10, 2021 14:49
A script to setup iptable rules
#!/usr/bin/env bash
[[ $EUID -ne 0 ]] && exec sudo $0 -- $@
set -e
command=${2:-help}
port=${3:-1024}
CHNROUTE_FILE="`dirname "$0"`/chnroute.txt"
IGNORE_FILE="`dirname "$0"`/ignore.txt"
#!/bin/bash
# by Felix Yan <https://github.com/felixonmars>
# stat of system update
echo $(head -n1 /var/log/pacman.log | cut -d " " -f 1,2) 以来一共滚了 $(grep -c "full system upgrade" /var/log/pacman.log) 次
@merrickluo
merrickluo / .doom.d-config.el
Last active September 18, 2023 09:22
Use pyim + liberime in doom-emacs
(use-package! liberime-config)
(use-package! pyim
;; :quelpa (pyim :fetcher github :repo "merrickluo/pyim")
:init
(setq pyim-title "R")
:config
;; (use-package pyim-basedict
;; :config
;; (pyim-basedict-enable))
(global-set-key (kbd "M-j") 'pyim-convert-string-at-point)
@merrickluo
merrickluo / userChrome.css
Created October 29, 2019 01:33
titlebar gone but buttons remain
#main-window:not([tabsintitlebar="true"]) #TabsToolbar > .toolbar-items {
visibility: collapse !important;
}
#main-window #titlebar {
height: 0;
min-height: 0;
}
#main-window #titlebar .titlebar-spacer {
@merrickluo
merrickluo / cvimrc
Last active May 8, 2019 08:23
My cvim config
unmap b
unmap B
map b :buffer<Space>
map B :bookmark<Space>
@merrickluo
merrickluo / wireguard.sh
Created August 11, 2018 14:14
wireguard.sh
#!/bin/bash
set -e
[[ $UID != 0 ]] && exec sudo -E "$(readlink -f "$0")" "$@"
up() {
# setup wg0
ip link add dev wg0 type wireguard
ip addr add dev wg0 10.0.200.13/32
wg setconf wg0 /etc/wireguard/wg0.conf
@merrickluo
merrickluo / gist:fd5f28b05c5032f35a8599d2adefe3f2
Created July 3, 2018 18:06
OpenCorsair Debug output commit 83e167b71f734e24df6193b651c0eddad52be437
usb device 0
corsair device 0
corsair device 1
corsair device 2
corsair device 3
corsair device 4
corsair device 5
corsair device 6
corsair device 7
corsair device 8
@merrickluo
merrickluo / gist:77c8b25ddb473c4d55274419431eaf15
Created July 3, 2018 17:58
OpenCorsair Debug output (testing branch)
Checking USB device 0 (1d6b:0003)...
Checking USB device 1 (1d6b:0002)...
Checking USB device 2 (1d6b:0003)...
Checking USB device 3 (046d:c539)...
Checking USB device 4 (04b4:0101)...
Checking USB device 5 (05e3:0608)...
Checking USB device 6 (05fc:0231)...
Checking USB device 7 (045e:02d1)...
Checking USB device 8 (0b05:1825)...
Checking USB device 9 (1b1c:0c03)...
@merrickluo
merrickluo / 4gamer.js
Created January 15, 2018 13:40
4gamer sales screenshot
const puppeteer = require('puppeteer')
const run = async function () {
const browser = await puppeteer.launch({
args: ['--no-sandbox'],
})
const page = await browser.newPage()
await page.goto('http://www.4gamer.net/games/117/G011794/20180111081/')
const games = await page.$("table.SALES_RANKING")
@merrickluo
merrickluo / number.js
Last active June 15, 2017 09:25
numbers
const isAllzero = function (num) {
return (num.toString().replace(/0/g, '') === '1')
}
const nextNumber = function (current, limit) {
const longer = parseInt(`${current}0`)
if (longer <= limit) {
return longer
}
const bigger = current + 1