Skip to content

Instantly share code, notes, and snippets.

@Wuvist
Wuvist / blue-owl.omp.json
Created February 3, 2024 15:46
Modified blue-owl theme for ohmyposh
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#a313a8",
"foreground": "#FFEB3B",
"style": "plain",
@Wuvist
Wuvist / ar1.typ
Last active January 15, 2024 15:59
ar1 recursive expansion
$
Y_t = beta_0 + beta_1 Y_(t-1) + epsilon_t
$
Take note of:
- $abs(beta_1) < 1$
- $epsilon_t tilde.op "WN"(0, sigma^2)$
- $Y_(t-1) = beta_0 + beta_1 Y_(t-2) + epsilon_(t-1) $
@Wuvist
Wuvist / process_scan_pages.py
Created December 25, 2023 15:23
Python Script to process scanned book pages
from PIL import Image, ImageOps
import cv2
import numpy as np
import pytesseract
pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
crop_w = 1310
crop_h = 2020
#!/usr/bin/env python3
import sys
formatted_json = sys.stdin.read()
from pygments import highlight, lexers, formatters
colorful_json = highlight(formatted_json, lexers.JsonLexer(), formatters.TerminalFormatter())
print(colorful_json)
@Wuvist
Wuvist / t.java
Last active December 17, 2020 14:08
class HelloWorld {
public static String getString(String key, String def) {
String cs = null;
Boolean containsKey = true;
return cs != null || containsKey ? cs == null ? null : cs.toString() : def;
}
public static String getString2(String key, String def) {
Boolean containsKey = true;
function setJava {
param (
[string]$version
)
$javaEnvs = @{
j8 = 'C:\java\jdk1.8.0_241'
j11 = "C:\java\jdk-11.0.9"
g8 = 'C:\java\graalvm-ce-java8-20.2.0'
}
@Wuvist
Wuvist / vec.go
Last active October 31, 2020 07:27
vec performance
package vec
type vec1 struct {
x, y, z, w float64
}
//go:noline
func (v vec1) addnoline(u vec1) vec1 {
return vec1{v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w}
}
@Wuvist
Wuvist / main.go
Created October 21, 2020 13:00
golang mock
package main
type base struct{}
type service struct {
sub *service
}
func (*service) create() (bool, error) {
return true, nil
function call<InType, OutType>(url: string, input: InType): Promise<OutType> {
return new Promise<OutType>((resolve, reject) => {wx.request({
url: url,
method: "POST",
data: input,
header: {
'content-type': 'application/json' // 默认值
},
success(res: wx.RequestSuccessCallbackResult) : void {
if(res.statusCode== 200){
@Wuvist
Wuvist / gist:3cd9f9c91022e27fd7ce153bffc2fbf6
Created February 14, 2019 06:47
Incompatible shapes.log
python .\import_example.py
2019-02-14 10:51:52.592998: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.7335
pciBusID: 0000:01:00.0
totalMemory: 8.00GiB freeMemory: 6.60GiB
2019-02-14 10:51:52.618169: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2019-02-14 10:51:53.007929: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-02-14 10:51:53.022297: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2019-02-14 10:51:53.031536: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2019-02-14 10:51:53.041526: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3276 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080, pci bus id: 0000:01:00.0, compute capability: 6.1)