Skip to content

Instantly share code, notes, and snippets.

View t510599's full-sized avatar
🪲
So many bugs.

Tony Yang t510599

🪲
So many bugs.
View GitHub Profile
@t510599
t510599 / fb-json-decoder.js
Last active March 26, 2019 17:01
FB 下載回來的資訊有夠坑人,好好的 utf-8 byte 被編成 \u00??,想解讀聊天紀錄都很不方便。 https://blog.stoneapp.tech/post.php?pid=139
/* required ES6 */
var fs = require('fs');
var path = require('path');
var json = JSON.parse(fs.readFileSync(path.resolve(__dirname, "./message.json"), 'utf8'));
var messages = json["messages"];
/* var messages = [
{
"sender_name": "Tony Yang",
"timestamp": 1526469371,
@t510599
t510599 / ig.js
Last active October 14, 2018 09:02
Getting image urls of an instagram post
len = (document.querySelector('._6CZji .coreSpriteRightChevron')) ? document.querySelectorAll('div.tN4sQ li._-1_m6').length : 1
index = 1
timer = setInterval(doing,500)
urls = []
function doing() {
imgs = document.querySelectorAll('._97aPb img')
if (index == 1){
urls.push(imgs[0].getAttribute('src'))
} else {
urls.push(imgs[1].getAttribute('src'))
@t510599
t510599 / README.md
Last active December 9, 2018 10:43
ckap auto login script

ckap login script

This script read ckap.txt and auto login for ckap
You can setup your network manager to run this script if connected to ckap.

This script used requests, you can install from pip.

Format

If your account is ck1071234 and password is mypasword
Separate account and password with space
Save ckap.txt with content:

@t510599
t510599 / ani.gamer.com.tw.js
Created October 11, 2019 16:26
ani.gamer.com.tw skip ad
async function sleep(ms) {
return new Promise((res, rej) => {
setTimeout(() => { res() }, ms);
});
}
(async () => {
$('#adult').click();
await sleep(500);
$('.vast-skip-button').addClass('enabled');
@t510599
t510599 / analyse.py
Last active April 23, 2020 15:08
Fetch students who passed first stage for analysing.
import json
with open("cac.json", "r", encoding="utf-8") as f:
cac_db = json.load(f)
with open("ntut.json", "r", encoding="utf-8") as f:
ntut = json.load(f)
with open("ntust.json", "r", encoding="utf-8") as f:
ntust = json.load(f)
@t510599
t510599 / gen.py
Last active January 17, 2021 16:20
Binary arithmetic (+, -) with two's complement
import random
from random import randint
print("1-1", "11-11", "11-0", "1-0", sep="\n")
for i in range(100):
op = random.choice(("+", "-"))
if op == "-":
a = randint(2**10, 2**20)
b = randint(0, a)
else:
@t510599
t510599 / README.md
Last active March 3, 2023 07:52
ACSC 2023 Quals - pcap 1, 2
@t510599
t510599 / README.md
Last active June 1, 2023 09:44
hackmd image backup

hackmd 用的圖床 imgur 要清掉舊圖了
怕 hackmd 文件裡面的圖全都被清光 所以來備份一下

Steps

  1. 設定 > 筆記設定 > 備份 > 下載所有筆記
  2. 解壓縮
  3. 把 image.py 搬進去同個資料夾
  4. 執行 image.py
  5. wget -i url.txt 來下載所有圖片
@t510599
t510599 / SerialNumberDetection.py
Created May 6, 2023 15:48
Acer SerialNumberDetectionTool in python
import subprocess
command = """powershell -Command \"(Get-WmiObject -Query \\"Select SerialNumber FROM Win32_BIOS\\")[\\"SerialNumber\\"].ToString()\""""
serial_number = subprocess.check_output(command, shell=True).decode().strip()
print("Serial Number:")
print(serial_number)
str1 = serial_number[10:10+3]
text = serial_number[13:13+5]
@t510599
t510599 / dump_gdrive_video.py
Created June 6, 2024 04:44
Dump video in Google Drive folder
import json
from urllib.parse import parse_qs
import requests as r
from bs4 import BeautifulSoup as Soup
import concurrent.futures
HEADERS = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0"}