Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# Add latency to all outgoing traffic on $DEV on tcp/udp $PORT,
# in the amount of $DELAY.
#
# This is matching on both source port and destination port, which
# may hit you twice if you're accessing a local resource.
#
# To see what's currently in effect,
# tc -s qdisc show dev lo
@goophile
goophile / i8kmon.py
Last active March 17, 2024 02:16
i8kmon/i8kfan for Dell Precision desktop
#!/usr/bin/python3
import re, subprocess, time
# On my Dell Precision desktop, the `i8kmon` controls the fan level according to the ambient temperature, not the CPU temperature.
# Maybe the i8kutils only works for laptop? I don't know. Luckly, the `i8kfan` CAN control the motherboard fan and CPU fan.
# It's usage is `i8kfan - -`, the first number is for motherboard, the second for CPU. You should test the sequence first.
# What this scirpt do is simple: get temperatures from `sensors`, and change the fan levels with `i8kfan`.
# It's similar to the original TCL version i8kmon.
@goophile
goophile / iciba-batch-search.py
Created November 18, 2018 15:09
Search a list of words and sync to iciba cloud.
"""
Search a list of words and sync to iciba cloud.
This script was tested only on Windows 7.
Preparation:
1) Install iciba: http://download.iciba.com/pc/personal2016/PowerWord.800.12012.exe
2) Install python and pyautogui.
3) Move iciba window to a fixed location.
4) Find out the coordinates of text input and search button. Change this script according to your needs.
@goophile
goophile / parse_words.py
Last active November 25, 2018 16:30
Get a list of words from a text file.
#!/usr/bin/env python3
import os
import sys
import re
import subprocess
from collections import Counter, OrderedDict
CUR_DIR = os.path.dirname(os.path.realpath(__file__))
@goophile
goophile / keybindings.json
Last active December 8, 2021 02:02
VSCode keybindings
// Place your key bindings in this file to override the defaults.
[
{
"key": "alt+left",
"command": "workbench.action.navigateBack",
"when": "editorTextFocus"
},
{
"key": "alt+right",
"command": "workbench.action.navigateForward",