Skip to content

Instantly share code, notes, and snippets.

View thislight's full-sized avatar

Rubicon Rowe thislight

View GitHub Profile
@thislight
thislight / 50-bbgu-netlogin
Last active April 5, 2023 08:06
OpenWRT自动登录BBGU网络
#!/bin/sh
WAN_IF="wan"
if [ "$INTERFACE" = "$WAN_IF" ]; then
if [ "$ACTION" = "ifup" ]; then
if [ "$(bbgu_netlogin loginp)" = "0" ]; then
IFACE="$INTERFACE" bbgu_netlogin login
fi
fi
@thislight
thislight / parkinglot.zig
Last active December 17, 2021 15:02
WebKit's ParkingLot in Zig. https://webkit.org/blog/6161/locking-in-webkit/ This implementation can automatically collect memory from old hash map instead of leaking.
//! Fast and small locks.
//! This implementation based on WebKit's https://webkit.org/blog/6161/locking-in-webkit/
const std = @import("std");
const futex = std.Thread.Futex;
const Allocator = std.mem.Allocator;
const Atomic = std.atomic.Atomic;
const assert = std.debug.assert;
const ThreadData = struct {
shouldPark: bool = false,
@thislight
thislight / g.py
Created October 19, 2019 10:42
g.py and js_sdk.py
import os
import glob
import yaml
import json
import glob
import argparse
from pluginbase import PluginBase
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:

Keybase proof

I hereby claim:

  • I am thislight on github.
  • I am thislight (https://keybase.io/thislight) on keybase.
  • I have a public key ASDZUtfytL3jRfw5vjIsNt9OBYxUQv719Lg8uUnsBhfGtQo

To claim this, I am signing this object:

@thislight
thislight / README.md
Created March 30, 2019 09:49
Protection call in dart

Call function in protection mode, it's more comfortable way to handle errors.
How to use:

void _handleMessage(WebSocket wsock, String data){
    var parts = pcall(() => _parseMessage(data), (error, st){
      _messageFormatNotAcceptedHandler(wsock, error, st);
    });
    if (isFail(parts)) return;
    var command = parts[0];
 Map playload = pcall(() => JSON.decode(parts[1]), (error, st){
@thislight
thislight / setup.sh
Last active July 9, 2017 10:37
Termux setup
echo "Setting up env."
#
apt update -y
#
apt upgrade -y
# Basic tools
apt install wget curl tar unzip patch man less nodejs python -y
@thislight
thislight / README.md
Last active March 6, 2019 11:58
自动下载并合并Hosts文件,在Fedora23上测试通过

自动下载并合并Hosts文件

hosts.py [--download] [--apply] [--addhosts url] [--pid]

  • --download 下载Hosts文件(合并至hosts.tmp)
  • --apply 应用至系统(/etc/hosts)
  • --addhosts url 添加URL到HOSTS源列表(hosts.json)
  • --pid 显示pid

默认携带的HOSTS源:

@thislight
thislight / InstallNeteaseMusicForFedora23.sh
Last active July 7, 2016 15:01
Fedora23添加 @Seaorsen 的源后貌似直接用dnf安装网易云音乐会报包长度错误,所以写了一个小脚本方便安装,记得需要root权限
#! /bin sh
# only for fedaora23
cd ~
wget http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-23.noarch.rpm
rpm -ivh rpmfusion-free-release-23.noarch.rpm
rm -rf rpmfusion-free-release-23.noarch.rpm
wget http://dl-http.senorsen.com/pub/package/linux/rpm/netease-cloud-music-0.9.0-4.x86_64.rpm
dnf install gstreamer1-plugins-ugly openal-soft opencore-amr qt5-qtmultimedia qt5-qtx11extras -y
rpm -ivh netease-cloud-music-0.9.0-4.x86_64.rpm
rm -rf netease-cloud-music-0.9.0-4.x86_64.rpm