Skip to content

Instantly share code, notes, and snippets.

@vifly
vifly / slogans.json
Created November 9, 2019 09:22
Slogans for viflythink.com
[
{
"content": "千里之行,始于足下"
},
{
"content": "与魔鬼战斗的人,应当小心自己不要成为魔鬼。当你凝视深渊时,深渊也在凝视着你"
},
{
"content": "自由并非免费赠饮"
},
@vifly
vifly / merge_OSTEP.py
Created September 27, 2020 05:08
合并 OSTEP 的 PDF 文件
#使用 https://gist.github.com/theagoliveira/65980c144bf53cf8ee5e351bd827d7e7
#下载 Operating Systems: Three Easy Pieces,然后用此脚本把下载的多个 PDF 文件合并。
#可以使用 https://pypi.org/project/pdfCatalog/ 为 PDF 生成目录,pdfCatalog 只
#考虑到中文章节的情况,为了成功生成目录,需要在运行此脚本后生成的 catalog.txt 首行插入“扉页 1”。
import glob
from os.path import *
from pdfrw import PdfReader, PdfWriter, IndirectPdfDict
@vifly
vifly / bills.py
Created November 9, 2020 11:49
Hackergame 2020 writeup code
import cn2an
result = 0
def remove_zero(amount: str) -> str:
if amount[0] == "零":
return amount[1:]
return amount
@vifly
vifly / remove_some_kde_applications.py
Created November 2, 2019 13:37
删除 kde-applications 中属于教育或游戏分类的应用,需要 root 权限,使用需谨慎
import subprocess
import glob
def is_need_remove(file_path):
with open(file_path, 'r') as f:
content = f.readlines()
for line in content:
if line.split("=")[0] == "Categories":
categories = line.split("=")[1]
# 如果分类字段里有 Education 或 Game,那么认为是需要删除的
@vifly
vifly / cat_answers_pro_max.py
Created October 30, 2021 05:46
Hackergame 2021 writeup code
import requests
cookies = dict(session="",
PHPSESSID="")
def crack(questions, answers):
data = {"q1": "20150504", "q2": "1", "q3": "Development Team of Library", "q4": "1", "q5": "/dev/null"}
for index, question in enumerate(questions):
data[question] = answers[index]
@vifly
vifly / PKGBUILD
Created July 29, 2023 15:26
Vifly's meta package for KDE applications
# Maintainer: Vily <viflythink@gmail.com>
pkgname=my-kde-applications-meta
pkgdesc="Vifly's meta package for KDE applications"
pkgver=1.0
pkgrel=1
arch=(any)
license=(None)
url='https://www.archlinux.org/'
depends=(colord-kde
kamera
@vifly
vifly / com.valvesoftware.Steam.desktop
Created August 7, 2023 13:17
my Steam desktop file
[Desktop Entry]
Name=Steam
Comment=Application for managing and playing games on Steam
Comment[pt_BR]=Aplicativo para jogar e gerenciar jogos no Steam
Comment[bg]=Приложение за ръководене и пускане на игри в Steam
Comment[cs]=Aplikace pro spravování a hraní her ve službě Steam
Comment[da]=Applikation til at håndtere og spille spil på Steam
Comment[nl]=Applicatie voor het beheer en het spelen van games op Steam
Comment[fi]=Steamin pelien hallintaan ja pelaamiseen tarkoitettu sovellus
Comment[fr]=Application de gestion et d'utilisation des jeux sur Steam
@vifly
vifly / crack_board.py
Created November 4, 2023 09:48
Hackergame 2023 writeup code
import requests
cookies = {"session": ""}
SESS = requests.session()
def crack():
data = {"x": "1", "y": "1"}
r = SESS.post("http://202.38.93.111:10077/", cookies=cookies, json=data)
print(r.json())