Skip to content

Instantly share code, notes, and snippets.

View SimonTheCoder's full-sized avatar

Simon Shi SimonTheCoder

  • Liaoning, China
View GitHub Profile
@SimonTheCoder
SimonTheCoder / video_concatenator.py
Created November 16, 2023 03:27
A script concats videos together into a single video.
import tkinter as tk
from tkinter import filedialog, messagebox, ttk, simpledialog
from moviepy.editor import VideoFileClip, concatenate_videoclips
from threading import Thread
import sys
def adjust_resolution(clip, target_resolution):
# Function to adjust video resolution while keeping the aspect ratio
target_width, target_height = target_resolution
@SimonTheCoder
SimonTheCoder / cert.py
Last active March 16, 2023 09:17
Scan a binary file, try to find x509 der certificates, then dump to files.
import OpenSSL.crypto as crypto
import sys
def progress_bar(current, total):
"""Print a progress bar to the console."""
progress = float(current) / float(total)
bar_length = 40
filled_length = int(round(bar_length * progress))
bar = '=' * filled_length + '-' * (bar_length - filled_length)
@SimonTheCoder
SimonTheCoder / save_canvas_to_png.js
Created January 10, 2023 04:06
Save canvas to image. Use it in browser console.
var clist = document.getElementsByClassName("inner_page");//change class name to yours or use other getElementXXX functions
var newTab = window.open('about:blank','canvase_to_image'); //need enable popup window for current site
for(ind=0;ind<clist.length;ind++){
var dataURL = clist[ind].toDataURL("image/png");
newTab.document.write("<img src='" + dataURL + "' alt='"+clist[ind].id+"'/><br/>");
}
@SimonTheCoder
SimonTheCoder / Clash_auto_switch.json
Created May 12, 2022 05:38
n8n scirpt to auto switch clash node
{
"name": "Clash auto switch",
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
240,
@SimonTheCoder
SimonTheCoder / TkinterExcel.py
Created May 3, 2022 02:55 — forked from RamonWill/TkinterExcel.py
The code from my video on how to view an excel file or Pandas Dataframe inside Tkinter (with comments)
# Youtube Link: https://www.youtube.com/watch?v=PgLjwl6Br0k
import tkinter as tk
from tkinter import filedialog, messagebox, ttk
import pandas as pd
# initalise the tkinter GUI
root = tk.Tk()
@SimonTheCoder
SimonTheCoder / terminal.py
Created March 20, 2022 05:32
Start a new terminal window from python
# def xterm():
# from tkinter import *
# import os
# root = Tk()
# termf = Frame(root, height=400, width=500)
# termf.pack(fill=BOTH, expand=YES)
# wid = termf.winfo_id()
@SimonTheCoder
SimonTheCoder / fez.log
Last active January 21, 2022 05:20
Writeup for CTF fez.py with symbolic executiong (claripy). This is a RE question includes a python source code(fez.py,modified for python3) and a log file(fez.log). The fez_sym.py is my solution with claripy.
50543fc0bca1bb4f21300f0074990f846a8009febded0b2198324c1b31d2e2563c908dcabbc461f194e70527e03a807e9a478f9a56f7
66bbd551d9847c1a10755987b43f8b214ee9c6ec2949eef01321b0bc42cffce6bdbd604924e5cbd99b7c56cf461561186921087fa1e9
44fc6f82bdd0dff9aca3e0e82cbb9d6683516524c245494b89c272a83d2b88452ec0bfa0a73ffb42e304fe3748896111b9bdf4171903
@SimonTheCoder
SimonTheCoder / bytes_entropy.py
Last active October 21, 2021 16:07
Calculate the entropy of a bytes array.
import numpy as np
from scipy.stats import entropy
def bytes_entropy(target_bytes,base=None):
v,c = np.unique([int(i) for i in target_bytes],return_counts=True)
if base is None:
base = len(target_bytes)
if base >256:
base = 256
return entropy(c,base=base)
@SimonTheCoder
SimonTheCoder / CookieClicker.py
Last active October 13, 2021 01:49
Auto CookieClicker. Press 'ALT' to stop clicker temporarily.
import win32gui
import win32api
import win32con
import re
import time
target_caption_reg = re.compile(".*Cookie Clicker.*")
target_hWnd = None
def enumWindowCallback(hWnd, arg1):
@SimonTheCoder
SimonTheCoder / bin2bmp-0.1.6_python3.py
Created January 17, 2021 12:41
bin2bmp modified for python3. If Image can not be found, install Pillow package(pip3 install Pillow) .
#!/usr/bin/env python3
#"Copyright 2009 Bryan Harris"
#
#This file is part of bin2bmp.py.
#
# bin2bmp.py is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#