Skip to content

Instantly share code, notes, and snippets.

@bayard
bayard / readme.md
Created September 21, 2024 06:53
openwrt build ignore error

make -j 9 IGNORE_ERRORS=m

@bayard
bayard / localhost.md
Created June 14, 2024 17:28
FIx localhost https insecure issue

Use Self Sign certificiate

Remove domain security policy: Steps for Chrome -

Go to : chrome://net-internals/#hsts Query HSTS/PKP domain for localhost Use Delete domain security policies option to delete configuration for localhost

@bayard
bayard / fix-win11-icon-png.md
Created May 29, 2024 04:02
Fix windows 11 taskbar icon missing and png thumbnails disappearing

The solution presented here by @Coder-M worked for me. It is for people that installed Google Drive.

In sum, go to HKEY_USERS[Your-User-ID]\Software\Classes.png\shellex and delete E357FCCD-A995-4576-B01F-234630154E96.

To find Your-User-ID you can go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist and look for the entry with a value like \Device\HarddiskVolume2\Users[Your-User-Name]\NTUSER.DAT. It is usually the one ending with 0001.

@bayard
bayard / chat.ts
Last active November 16, 2023 18:43 — forked from AnsonT/chat.ts
Stream OpenAI response though NextJS API route
import { NextApiRequest, NextApiResponse } from 'next'
import { Readable } from 'node:stream'
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { authorization } = req.headers
if (!authorization || authorization !== process.env.AUTHORIZATION_HEADER) {
return res.status(401).json({ error: 'Unauthorized' })
}
const openAIUrl = process.env.OPENAI_URL as string
@bayard
bayard / extension.js
Created November 9, 2023 06:42
SSH here VS Code extension using powershell instead of default terminal
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.activate = void 0;
const vscode = require("vscode");
const os = require("os");
const path = require("path");
const fs = require("fs");
const sshConfig = require("ssh-config");
function findSSHConfigPaths() {
const homeDir = os.homedir();
@bayard
bayard / api.txt
Created September 21, 2023 06:16
Fun APIs
https://uselessfacts.jsph.pl/api/v2/facts/random
@bayard
bayard / cloudflare-direct.txt
Created September 17, 2023 09:38
shadowrocket config
https://raw.githubusercontent.com/bayard/shadowrocket-rules/main/sw-rules-cf-mask.conf
@bayard
bayard / nginx.conf
Created May 6, 2023 15:20 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@bayard
bayard / Hyper-V PCI-Passthroug.ps1
Created May 1, 2023 20:01 — forked from Ruffo324/Hyper-V PCI-Passthroug.ps1
Hyper-V PCIe passthrough CheatSheet
# Change to name of TARGET-VM.
$vm='CHANGE_ME'
# Change to PCI device location (💡 Location).
$Location = 'CHANGE_ME'
# Enable CPU features.
Set-VM -GuestControlledCacheTypes $true -VMName $vm
# Host-Shutdown rule must be changed for the VM.
Set-VM -Name $vm -AutomaticStopAction TurnOff
<!DOCTYPE html>
<html>
<head>
<title>simple calculator</title>
<meta charset="UTF-8">
<style>
/*设置table样式*/
/*Set the style of the table*/
table {
border: 2px solid;