Skip to content

Instantly share code, notes, and snippets.

View byte-sourcerer's full-sized avatar

cjw byte-sourcerer

View GitHub Profile
diff --git a/include/linux/log2.h b/include/linux/log2.h
index ef3d4f67118c..c373295f359f 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -16,12 +16,6 @@
#include <linux/bitops.h>
/*
- * deal with unrepresentable constant logarithms
- */
/*
* Disclaimer: Possible loss of data!! This code was written by the students
* who took the Operating System module at Zhejiang University. Use it at
* your own will and risk! If you do not know what the code does, please try
* not to use it.
*/
#include <stdio.h>
main()
{
# intellij
.idea
.gradle
out/
bin/
gradle/
build/
# vscode
.vscode/
@byte-sourcerer
byte-sourcerer / QuantumultX_js.conf
Created March 6, 2021 02:17
QuantumultX js config
hostname = api.weibo.cn, mapi.weibo.com, *.uve.weibo.com, mp.weixin.qq.com, api.bilibili.com, app.bilibili.com, www.zhihu.com, api.zhihu.com, link.zhihu.com, aweme*.snssdk.com, *.kuwo.cn, *.xiaoxiao*.com, *.amemv.com, p.du.163.com, getuserinfo.321mh.com, getuserinfo-globalapi.zymk.cn, ios.fuliapps.com, vsco.co, api.vnision.com, *.my10api.com, apple.fuliapps.com, newdrugs.dxy.cn, app101.avictown.cc, api.hlo.xyz, api.ijo.xyz, www.luqijianggushi.com, account.wps.cn, u.kanghuayun.com, api1.dobenge.cn, api.mvmtv.com, mitaoapp.yeduapp.com, origin-prod-phoenix.jibjab.com, www.3ivf.com, pay.guoing.com, api.bjxkhc.com, viva.v21xy.com, biz.caiyunapp.com, ap*.intsig.net, mp.bybutter.com, api.vuevideo.net, api.picsart.c*, api.meiease.c*, ios.xiangjiaoapps.com, apple.xiangjiaoapps.com, *.xiangxiangapps.com, trade-acs.m.taobao.com, api.m.jd.com, ios.prod.ftl.netflix.com
# 去微博应用内广告 (By yichahucha)
^https?://(sdk|wb)app.uve.weibo.com(/interface/sdk/sdkad.php|/wbapplua/wbpullad.lua) url script-response-body https://raw.gith
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch -y # Linux
conda install -c conda-forge tensorflow -y
conda install -c conda-forge mypy -y
conda install -c anaconda seaborn -y
conda install -c anaconda pandas -y
conda install -c conda-forge matplotlib -y
conda install -c anaconda scikit-learn -y
pip install opencv-contrib-python-headless # support opencl instead of using conda, headless for server
conda install -c anaconda jupyter -y
conda install -c conda-forge pytorch-lightning -y
@byte-sourcerer
byte-sourcerer / QuantumultX_js.conf
Created October 17, 2021 03:03
QuantumultX Config
^https?://(www\.)?g\.cn url 302 https://www.google.com
^https?://(www\.)?google\.cn url 302 https://www.google.com
^https?://(www\.)?google\.cn/search url 302 https://www.google.com/search
def show_opencv_image(image):
from matplotlib import pyplot as plt
image = image[:,:,::-1]
plt.imshow(image)
plt.show()
@byte-sourcerer
byte-sourcerer / extract_rcnn_box_features_detectron2.py
Last active November 20, 2021 01:03
Detectron2 Extract Box Features
import cv2
import torch
from detectron2.config import get_cfg
from detectron2.engine import DefaultPredictor
from detectron2.model_zoo import model_zoo
from detectron2.utils.visualizer import Visualizer
def extract_box_features(model, image_cv, cfg):
device = cfg.MODEL.DEVICE
@byte-sourcerer
byte-sourcerer / MacEditorTextView.swift
Created October 31, 2021 10:46
An NSTextView wrapped by SwiftUI with TextKit 2
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://twitter.com/tholanda
*
* MIT license
* Modified by https://github.com/cjwcommuny for TextKit 2
*/
import Combine
@byte-sourcerer
byte-sourcerer / toggle.js
Created November 6, 2021 07:43
macOS Monterey Toggle Cursor Size
// see https://apple.stackexchange.com/a/430338/433504
function fn() {
const cursorSizeSmall = 1
const cursorSizeLarge = 4
const isRunningSystemPreferences = Application('System Preferences').running()
Application('System Preferences').panes.byId('com.apple.preference.universalaccess').anchors.byName('Seeing_Cursor').reveal()
const process = Application('System Events').processes.byName('System Preferences')
while (process.windows.length == 0) {}