Skip to content

Instantly share code, notes, and snippets.

@undeflife
undeflife / perf_aspect.rb
Created October 26, 2013 14:55 — forked from gcao/.rvmrc
class ApplicationController
end
class Products < ApplicationController
# Action
def action
foo
bar
end

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
#!/bin/bash
set -eu
SYSCTL_FILE=/etc/sysctl.d/90-tcp-bbr.conf
# check root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
@undeflife
undeflife / capslock.json
Last active July 28, 2022 06:30
Capslock Enhancement
{
"title": "Capslock Enhancement",
"author": "Vonng([email protected])",
"homepage": "https://github.com/Vonng/Capslock",
"hostpage": "https://pqrs.org/osx/karabiner/complex_modifications/",
"manual": "https://github.com/Vonng/Capslock/tree/master/mac",
"import_url": "karabiner://karabiner/assets/complex_modifications/import?url=https://gist.githubusercontent.com/undeflife/b74f08d3db840d0394f89be024559e0c/raw/ace0c84ea7c2ee6bec09520064c47f71ad1440e6/capslock.json",
"rules": [
{
"description": "CapsLock to Hyper/Escape",
@undeflife
undeflife / unicode.c
Created November 17, 2022 07:29 — forked from tommai78101/unicode.c
UTF-8 to UTF-16 one-way conversion, written in C
#include <stdio.h>
#include <stdlib.h>
#include <uchar.h>
#include <locale.h>
#define __STD_UTF_16__
//Pointer arrays must always include the array size, because pointers do not know about the size of the supposed array size.
void utf8_to_utf16(unsigned char* const utf8_str, int utf8_str_size, char16_t* utf16_str_output, int utf16_str_output_size) {
//First, grab the first byte of the UTF-8 string