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
Last active May 9, 2020 17:15
Telegram Game Bot "Math Battle" solution
@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"
@iBug
iBug / main.go
Last active May 23, 2022 05:59
Advanced 24 game solver
package main
import (
"flag"
"fmt"
"math"
"math/rand"
"sort"
"strconv"
"strings"
@iBug
iBug / run.sh
Created October 4, 2022 19:29
Gather JSON logs from Lambda functions from CloudWatch
#!/bin/sh
if [ -z "$1" ]; then
exit 1
fi
now=$(date +%s)
function_name="$1"
query_id=$(aws logs start-query \