Skip to content

Instantly share code, notes, and snippets.

View iBug's full-sized avatar
👓
Prolonging life span

iBug

👓
Prolonging life span
View GitHub Profile
@iBug
iBug / keybase.md
Created August 30, 2018 23:31
Keybase

Keybase proof

I hereby claim:

  • I am iBug on github.
  • I am ibug (https://keybase.io/ibug) on keybase.
  • I have a public key whose fingerprint is F369 14ED 8DF3 2E42 F2A1 B397 6C33 87F3 EC0F 9B05

To claim this, I am signing this object:

@iBug
iBug / README.md
Created March 4, 2020 16:30
摩尔庄园「米饭」自动签到脚本

使用方法:在 def main() 里面写上你的米米号和密码,找个服务器配置好定时任务(建议一天试 2 ~ 3 次),然后你就可以坐享各种活动的参与奖励了。

@iBug
iBug / README.md
Last active May 9, 2020 17:15
Telegram Game Bot "Math Battle" solution
@iBug
iBug / convert.rb
Created August 15, 2020 17:01
Shadowsocks JSON 格式订阅链接转换为 ss:// 剪贴板格式(Ruby)
require 'json'
require 'net/http'
require 'base64'
require 'cgi'
subscription_url = 'YOUR_URL_HERE'
config = JSON.parse Net::HTTP.get URI(subscription_url)
config['configs'].each do |item|
s = 'ss://'
@iBug
iBug / README.md
Created November 24, 2020 16:41
Setup IPsec encryption on Linux using `ip xfrm` (No additional software required)

Setup IPsec encryption on Linux using ip xfrm

Using Linux builtin IP XFRM object, no additional software (like StrongSwan) is required.

Usage

Put both shell scripts under /etc/ipsec and the service file under /etc/systemd/system. Make sure /etc/ipsec/keys exists and is a directory (where keys will be generated and stored). Do this on both hosts. Note that the IP addresses should be swapped (and possibly replaced by its local address - the one behind any NAT present) on the remote host.

Edit all.sh to include all links you want to encrypt. Run all.sh once to produce keys, and copy the corresponding keys to the remote host. Run the edited all.sh on the remote host again.

@iBug
iBug / README.md
Created March 9, 2022 14:30
How-to implement page navigation icons for Material for MkDocs theme ($12k funding goal feature)

Implementing the "page navigation icons" feature for Material for MkDocs

Disclaimer: I have never seen the source code for Material for MkDocs Insider (the "Insider"). Anything described in this article is for demonstration purposes only. Use at your own risk.

So how does the [page navigation icons][1] feature look to you? If you find it attractive but can't wait for the $12k funding goal, you can implement this yourself and get it up and running.

Modify theme template

Start by grabbing a copy of [material/partials/nav-item.html][2] from the repository and putting it in overrides/partials/nav-items.html in your repository. Enable [custom_dir: overrides][3] as per the docs.

@iBug
iBug / settings.json
Created March 15, 2022 17:13
PuTTY colors for Windows Terminal
{
"background": "#000000",
"black": "#000000",
"blue": "#0000DF",
"brightBlack": "#555555",
"brightBlue": "#5555FF",
"brightCyan": "#55FFFF",
"brightGreen": "#55FF55",
"brightPurple": "#FF55FF",
"brightRed": "#FF5555",
@iBug
iBug / mersenne.c
Last active April 9, 2022 10:18
Quick Mersenne Prime test using Lucas-Lehmer method and GMP library
#include <stdio.h>
#include <math.h>
#include <gmp.h>
int test_p(int p) {
if (p % 2 == 0)
return 0;
for (int i = 3; i <= sqrt(p); i += 2)
if (p % i == 0)
return 0;
@iBug
iBug / main.go
Last active April 29, 2022 11:57
Basic 24 game solver
package main
import (
"flag"
"fmt"
"math"
"math/rand"
"strconv"
"time"
)
@iBug
iBug / cpu-temp.py
Last active May 2, 2022 17:23
CPU Temperature Monitor
#!/usr/bin/python3
import sys
import time
import curses
class Config:
temp_source = "/sys/class/thermal/thermal_zone0/temp"
freq_source = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"