Skip to content

Instantly share code, notes, and snippets.

@IvanaGyro
IvanaGyro / Issue about selecting SVG.POWERPOINT.yaml
Created February 21, 2023 15:35
Demo the issue about selecting SVG.
name: Issue about selecting SVG
description: Demo the issue about selecting SVG.
host: POWERPOINT
api_set: {}
script:
content: >+
$("#run").click(() => tryCatch(run));
const run: Function = async () => {
@IvanaGyro
IvanaGyro / Formulas for Word.WORD.yaml
Last active February 26, 2023 10:56
Insert math equations into the online version of Word.
name: Formulas for Word
description: Insert math equations into the online version of Word.
host: WORD
api_set: {}
script:
content: >
var editor;
const MathJax = window["MathJax"];
@IvanaGyro
IvanaGyro / find_kobo_lowest_price.js
Created December 23, 2022 18:56
找 Kobo 上面最便宜的國家
/**
* 1. Get current rates from https://www.xe.com/api/protected/midmarket-converter/
* 2. Replace "rates" object with the correct currency rates.
* 3. Select a book on Kobo.
* 4. Click the country flag at the top right corner.
* 5. Execute this script.
*/
rates = {
ADA: 3.8456167243,
@IvanaGyro
IvanaGyro / createNTUCourseEvents.js
Last active September 10, 2022 16:44
Create the Google Calendar event links of the courses on the NTU "My Schedule" page.
javascript: (() => {
/**
* This script is used to create the Google Calendar event links of the
* courses on the NTU "My Schedule" page.
*/
if (
location.href !== "https://nol.ntu.edu.tw/nol/coursesearch/myschedule.php"
) {
return;
}
@IvanaGyro
IvanaGyro / Beiyi.py
Created January 13, 2022 13:25
嘲諷北宜區間測速
'''
WARNING: This model does NOT reflect the situation of the real world, and
I(the author) do NOT like to decide which policy the government should
implement based on accidents data.
'''
import sys
import random
if not sys.version_info.major == 3 and sys.version_info.minor >= 7:
@IvanaGyro
IvanaGyro / copy_result.js
Last active January 17, 2021 16:58
Copy results of Taipei traffic violation reports from Gmail web page to the clipboard.
/**
* Usage:
* 1. Minify this script.
* 2. Rewrite minified script to `javascript:THE_MINIFIED_SCIPT`.
* 3. Add modified script to your bookmark.
* 4. Click it when you're at the Gmail page.
*/
(async function () {
if (location.hostname != 'mail.google.com') return;
@IvanaGyro
IvanaGyro / extract_ooni.py
Last active September 4, 2020 03:24
把OONI測試趨勢家長防護網的結果從資料庫中匯出至CSV
import csv
import json
import pathlib
import re
import sqlite3
import sys
import urllib
from pprint import pprint
from bs4 import BeautifulSoup
@IvanaGyro
IvanaGyro / Chapter-1-6.hs
Last active July 31, 2020 08:57 — forked from banacorn/Chapter-1-6.hs
FLOLAC 2020「邏輯、語言、與計算暑期研習營」的課前作業
-- This exercise covers the first 6 chapters of "Learn You a Haskell for Great Good!"
-- Chapter 1 - http://learnyouahaskell.com/introduction
-- Chapter 2 - http://learnyouahaskell.com/starting-out
-- Chapter 3 - http://learnyouahaskell.com/types-and-typeclasses
-- Chapter 4 - http://learnyouahaskell.com/syntax-in-functions
-- Chapter 5 - http://learnyouahaskell.com/recursion
-- Chapter 6 - http://learnyouahaskell.com/higher-order-functions
-- Download this file and then type ":l Chapter-1-6.hs" in GHCi to load this exercise
@IvanaGyro
IvanaGyro / demo_argspec.py
Created June 23, 2020 07:35
Demo `getargspec` and `getfullargspec`
from inspect import getargspec, getfullargspec
def kwargs_only(a, b, c=3, d=4, **kwargs):
pass
def default_args(a, b, c=3, d=4, *args, **kwargs):
pass
def default_kwargs(a, b, *args, c=3, d=4, **kwargs):
@IvanaGyro
IvanaGyro / seq2lookup.py
Created June 23, 2020 06:45
Sequence to lookup map -- a stupid function
from typing import Dict, List, Iterable, Hashable, Mapping, Sequence
def seq2lookup(
seqences: Iterable[Sequence], index: int,
) -> Dict[Hashable, Sequence]:
"""
Build the lookup table from a group of sequences.
The lookup table is used to quickly find the target sequence with the
corresponding item which is at the specific index of the target sequence.