Skip to content

Instantly share code, notes, and snippets.

View haruue's full-sized avatar
✌️
Playing Vue.js

Haruue haruue

✌️
Playing Vue.js
View GitHub Profile
@haruue
haruue / _使用 Nix 解决 Debian 11 上无法给 6.x 内核安装 dkms 模块的问题.md
Last active August 7, 2024 03:20
使用 Nix 解决 Debian 11 上无法给 6.x 内核安装 DKMS 模块的问题

使用 Nix 解决 Debian 11 上无法给 6.x 内核安装 DKMS 模块的问题

解决方案

前提条件

服务器的网络至少要能顺畅地访问 Nix Cache(https://cache.nixos.org), 大部分用作代理的(中国境外的)服务器通常都没有问题。

步骤

@haruue
haruue / sniproxy.json
Last active February 24, 2024 03:36
using v2ray as sniproxy
{
"log": {},
"inbounds": [
{
"protocol": "dokodemo-door",
"listen": "10.11.5.2",
"port": 80,
"settings": {
"address": "255.255.255.254",
"port": 80,
@haruue
haruue / nptcalc.py
Last active August 2, 2023 05:51
Address calculator for netfilter/ip6t_NPT
import sys
import socket
import ipaddress
def csum_add(csum, addend):
csum += addend
if csum > 0xFFFF:
return (csum&0xFFFF) + 1
return csum & 0xFFFF
@haruue
haruue / xtables-addons-kmod.nix
Last active January 5, 2025 23:10
Nix packages for xtables-addons
{ stdenv, lib, linuxPackages, kernel ? linuxPackages.kernel, kmod }:
let
kbuilddir = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
in
stdenv.mkDerivation rec {
name = "xtables-addons-kmod-${version}-${kernel.version}";
version = "3.24";
src = fetchTarball {
@haruue
haruue / 20-bogons.conf
Created June 7, 2022 05:27
IPv4 & IPv6 bogons in BIRD format
define hn2_pl_bogons_v4 = [
0.0.0.0/8+, # RFC 1122 'this' network
10.0.0.0/8+, # RFC 1918 private space
100.64.0.0/10+, # RFC 6598 Carrier grade nat space
127.0.0.0/8+, # RFC 1122 localhost
169.254.0.0/16+, # RFC 3927 link local
172.16.0.0/12+, # RFC 1918 private space
192.0.2.0/24+, # RFC 5737 TEST-NET-1
192.88.99.0/24+, # RFC 7526 deprecated 6to4 relay anycast
192.168.0.0/16+, # RFC 1918 private space
@haruue
haruue / dmenu_move_to_workspace
Last active April 9, 2022 07:15
i3 demu workspace
#!/bin/bash
selected_workspace=$(i3-msg -t 'get_workspaces' | jq -r '.[] | .name' | dmenu)
if [ $? -eq 0 ]; then
i3-msg "move container to workspace $selected_workspace"
fi

Keybase proof

I hereby claim:

  • I am haruue on github.
  • I am haruue (https://keybase.io/haruue) on keybase.
  • I have a public key whose fingerprint is 8E5F CFA4 78CC 95E0 73E1 1FC1 28D3 B779 3561 6774

To claim this, I am signing this object:

@haruue
haruue / vps2arch-swas
Last active August 14, 2021 12:49
vps2arch for aliyun swas
#!/bin/sh
# Copyright 2015, Timothy Redaelli <[email protected]>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@haruue
haruue / ubd_kern.i
Created May 8, 2018 18:53
gcc 8.1.0 run out of memory
This file has been truncated, but you can view the full file.
# 1 "arch/um/drivers/ubd_kern.c"
# 1 "/tmp/linux-4.16//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "././include/linux/kconfig.h" 1
@haruue
haruue / markdown-test.md
Last active January 27, 2024 01:50
markdown sample for markdown parser

Markdown Test

title

atx title

Heading 1

Heading 2

Heading 3