Skip to content

Instantly share code, notes, and snippets.

View wyw's full-sized avatar

Yuanwei Wu wyw

  • 07:23 (UTC +08:00)
View GitHub Profile
@wyw
wyw / bing_chat_scroll.user.js
Last active September 5, 2023 16:18
Disable Bing Search Engine Scroll
// ==UserScript==
// @name Disable Bing Search Engine Scroll
// @author reddit.com/u/pinpann
// @namespace reddit.com/comments/11dautm/comment/ja7ngte
// @description Disables scrolling on the Bing search engine page to prevent accidental scrolling into the Bing chat feature.
// @match https://www.bing.com/*
// @icon https://www.bing.com/favicon.ico
// @version 1.0
// @grant none
// @homepageURL https://reddit.com/11f1yb6
@wyw
wyw / raspberrypi.zsh-theme
Last active June 13, 2023 17:53
Yet Another Theme for Oh My Zsh
# https://www.ditig.com/256-colors-cheat-sheet
local OMZ_THEME_FRUIT_COLOR=161
local OMZ_THEME_LEAF_COLOR=77
local OMZ_THEME_GIT_LOGO_THEME_COLOR=202
local OMZ_THEME_PROMPT_STRING_COLOR=12
local OMZ_THEME_BACKGROUND_COLOR=236
local OMZ_THEME_NEWLINE=$'\n'
[[ "$USERNAME" == 'root' ]] && OMZ_THEME_PROMPT_STRING_COLOR=9
@wyw
wyw / ansible_local_playbooks.md
Created December 20, 2018 06:01 — forked from alces/ansible_local_playbooks.md
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
@wyw
wyw / pve-ip.user.js
Last active December 14, 2018 11:16
// ==UserScript==
// @name PVE IP
// @namespace http://tampermonkey.net/
// @version 0.1
// @include https://*:8006/*
// ==/UserScript==
(function (i, s, o, g, r, c, a, m) {
i['global_clipboard'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
@wyw
wyw / gist:e02749e6bd4948fbfb44100c4e202e39
Created September 28, 2018 08:30 — forked from jaxbot/gist:5748513
Block nginx from serving .git directories
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}
@wyw
wyw / apfs_cli_tools.txt
Created September 13, 2018 06:54 — forked from timsutton/apfs_cli_tools.txt
apfs tools in Sierra
➜ ~ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.1
BuildVersion: 16B2333a
➜ ~ ls -l /System/Library/Filesystems/apfs.fs/Contents/Resources
total 2088
-rwxr-xr-x 1 root wheel 349760 22 Sep 03:48 apfs.util
-rwxr-xr-x 1 root wheel 352880 22 Sep 03:48 apfs_invert
@wyw
wyw / container.go
Created June 1, 2018 02:53 — forked from christophberger/container.go
A container in less than 60 lines of Go
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@wyw
wyw / monitor.php
Created May 26, 2018 15:14 — forked from jesobreira/monitor.php
Server Monitor
<?php
/*
The aim is to create a functional server monitor based on the one
showed on Mark Zuckerberg's monitor on The Social Network movie.
Run so:
php monitor.php
Notes:
- The server LogFormat must be "Common Log Format" (%h %^[%d:%^] "%r" %s %b)
@wyw
wyw / hmac_sha256.py
Created March 13, 2018 03:41 — forked from theY4Kman/hmac_sha256.py
Python SHA-256 HMAC
from Crypto import HMAC, SHA256
def hmac_sha256(key, msg):
hash_obj = HMAC.new(key=key, msg=msg, digestmod=SHA256)
return hash_obj.hexdigest()
git branch -d $(git branch --merged | awk '{print $1}' | grep -v "*")