Skip to content

Instantly share code, notes, and snippets.

View JiashengWu's full-sized avatar

JiashengWu

View GitHub Profile
// ==UserScript==
// @name BetterChatGPT
// @description Hopefully I can make ChatGPT look better!
// @version 0.1
// @author JiashengWu
// @namespace https://chat.openai.com/
// @match https://chat.openai.com*
// @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
// @grant GM_addStyle
// ==/UserScript==
#!/bin/bash
set -eo pipefail
[[ -n "${DEBUG}" ]] && set -x # `DEBUG=1 <cmd>` to debug this script
[[ -n "${DRYRUN}" ]] && DRYRUN=1 # `DRYRUN=1 <cmd>` to print the commands only
[[ -n "${VERBOSE}" ]] && VERBOSE=1 # `VERBOSE=1 <cmd>` to print more logs
function usage() {
exe=$(basename ${0})
echo "
@JiashengWu
JiashengWu / index.html
Last active December 24, 2021 09:12
Monty Hall problem.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-16">
<title>猜猜猜</title>
<style type="text/css">
table {
width: 100%;
text-align: center;
}
@JiashengWu
JiashengWu / jiashenglize.sh
Last active April 18, 2023 21:20
My customized shell settings.
# oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/wting/autojump.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/autojump && cd ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/autojump && ./install.py && cd -
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
if grep -q '^plugins=' ~/.zshrc \
&& ! grep -q 'autojump' ~/.zshrc \
&& ! grep -q 'zsh-autosuggestions' ~/.zshrc \
&& ! grep -q 'zsh-syntax-highlighting' ~/.zshrc
then
@JiashengWu
JiashengWu / generate_video.py
Created December 7, 2020 17:31
Convert images in this folder to video.
#!/usr/local/bin/python3
import argparse
import os
import re
import cv2 # pip install opencv-contrib-python
from vidstab import VidStab # https://github.com/AdamSpannbauer/python_video_stab
# Defaults
SRCFMT = 'jpeg'
@JiashengWu
JiashengWu / SwitchSoundOutput.applescript
Last active March 12, 2022 18:40
Switch sound output device
# Name: SwitchSoundOutput
# Description: Switch sound output device
# Pre-reqs: brew install switchaudio-osx
set OUTPUT1 to "MacBook Pro Speakers"
set OUTPUT2 to "External Headphones"
set cmd to "/usr/local/bin/SwitchAudioSource -t output "
set curr_output to do shell script cmd & "-c"
if curr_output is equal to OUTPUT1 then
@JiashengWu
JiashengWu / generate_gif.py
Last active December 7, 2020 17:34
Convert images in this folder to GIF.
#!/usr/bin/env python
import argparse
import os
import re
from PIL import Image
# Defaults
SRCFMT = 'jpeg'
OUTPUT = 'output'
@JiashengWu
JiashengWu / arr2idx.java
Created December 17, 2019 21:35
获取乱序数组的序号
import java.util.Arrays;
import java.util.Comparator;
public class arr2idx {
public static void main(String[] args) {
int[] arr = new int[]{10, 8, 0, 5, 3};
System.out.println(Arrays.toString(arr)); // [10, 8, 0, 5, 3]
@JiashengWu
JiashengWu / max_id.py
Last active November 15, 2019 21:42
Search Instagram by date.
from datetime import datetime
from pytz import timezone
yyyy, mm, dd = 2018, 11, 22
tz = timezone('US/Pacific')
# init dates and get timestamp diff by millisecond
date = datetime(yyyy, mm, dd, tzinfo=tz)
base = datetime(2011, 8, 24, tzinfo=timezone('US/Pacific'))
diff = int(date.timestamp() - base.timestamp()) * 1000
@JiashengWu
JiashengWu / stella_rosa_wines.py
Last active August 26, 2019 05:54
#StellaRosaWines #BeautifulSoup #Python
import json
import requests
from bs4 import BeautifulSoup
# fetch html doc of our wines page (which contains all wines)
our_wines_url = 'https://stellarosawines.com/our-wines/'
html_doc = requests.get(our_wines_url).text
soup = BeautifulSoup(html_doc, 'html.parser')
# print(soup.prettify())