Skip to content

Instantly share code, notes, and snippets.

@lightsing
lightsing / hyper-panic.rs
Created July 10, 2023 07:03
panic handler behaviour
use std::convert::Infallible;
use std::net::SocketAddr;
use tokio::runtime::UnhandledPanic;
use hyper::{Body, Request, Response, Server};
use hyper::service::{make_service_fn, service_fn};
async fn panic(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
panic!("expected");
}
class Glut < Formula
homepage "http://iihm.imag.fr/blanch/software/glut-macosx"
url "http://iihm.imag.fr/blanch/software/glut-macosx/glut-3.3.2.zip"
version "3.3.2"
sha256 "f058aa81861e943151ca4546714af895eccae855692aff008f4eb16a6abd1186"
patch do
url "http://iihm.imag.fr/blanch/software/glut-macosx/patches/glut-3.3.2-0-compilation.patch"
sha256 "937fd0d2e362ef2689a8fe1b41b695154c0beb5be592d43c79812f4238c8c3bb"
end
@lightsing
lightsing / bt_neu6_scores_calc.user.js
Last active October 20, 2018 03:31
计算 bt.neu6.edu.cn 资源价值得分
// ==UserScript==
// @name 计算资源价值
// @namespace https://lightsing.me/
// @version 0.1
// @description 计算 bt.neu6.edu.cn 资源价值得分
// @author lightsing
// @match http://bt.neu6.edu.cn/plugin.php?id=neubt_resourceindex*
// @grant none
// ==/UserScript==
{"sig":"1da4506651e62e903c0dd5e06713a1bf6548bedbaf884c48cb2d8494ee3f9132225990be3bee3dbb4cdb41bbda9f62aa688fe7bc562b458a51f442a84a7cffda1","msghash":"f02fc214c884439ab241f79b9c77280310465453eb227090448c1a5c6b8e0657"}
@lightsing
lightsing / set_route.py
Last active February 20, 2018 08:56
tinc route table setting
#!/bin/python
# -*- coding: utf-8 -*-
# pywin32 required
# pip install pypiwin32
import os
import sys
import types
import math
import ftplib
import traceback
@lightsing
lightsing / keybase.md
Last active April 8, 2021 07:27
Keybase Proof

Keybase proof

I hereby claim:

  • I am lightsing on github.
  • I am lightsing (https://keybase.io/lightsing) on keybase.
  • I have a public key whose fingerprint is B72C 5D55 56C2 6A6A 769C 0161 3BF0 3390 89EA 0E43

To claim this, I am signing this object:

@lightsing
lightsing / say_server.py
Created April 24, 2017 11:46
Mac OS Say API Server
"""
Mac OS Say API Server.
http://ip:port/say/something
"""
import os
import random
import asyncio
import urllib.parse
from subprocess import call
@lightsing
lightsing / sakaiAssignmentsHelper.user.js
Created April 4, 2017 14:10
Highlight Sakai Assignments
// ==UserScript==
// @name Highlight Assignments
// @namespace lab.lightsing.me
// @version 0.1
// @description Fxxk Java Assignments
// @author lightsing
// @match http://sakai.sustc.edu.cn/portal/site/*
// @grant none
// ==/UserScript==
@lightsing
lightsing / xsync.sh
Last active March 21, 2017 13:45
My sync bash script
#!/bin/bash
MIRROR=/data/mirrors
PUBLISH=/data/publish
UPSTREAM=mirrors.tuna.tsinghua.edu.cn
LOG=/etc/xmirror
RED='\033[0;31m'
NC='\033[0m'
BLUE='\033[1;34m'
@lightsing
lightsing / sakaiAutoLogin.user.js
Created March 7, 2017 05:13
Sakai Auto Login
// ==UserScript==
// @name Sakai Auto Login
// @namespace lab.lightsing.me
// @version 0.1
// @description Auto Login Sakai
// @author lightsing
// @match http://sakai.sustc.edu.cn/portal
// ==/UserScript==
(function() {