Skip to content

Instantly share code, notes, and snippets.

View gokaybiz's full-sized avatar
🌪️
Focusing

gokaybiz

🌪️
Focusing
View GitHub Profile
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <file_path> <md5|sha256>"
exit 1
fi
file_path="$1"
algorithm="$2"
@gokaybiz
gokaybiz / main.py
Created February 8, 2023 07:58
DiabloIII zoom utility
import pymem
import windows
PROCESS_NAME = 'Diablo III64.exe'
THREADSTACK0 = 0x000007D8
OFFSETS = [0xC10, 0xAD8, 0x48, 0x18]
def get_thread_local_storage(process_name: str):
target_process = None
pointer_size = 4 * 2
@gokaybiz
gokaybiz / m3u8ToMp4.txt
Created October 26, 2022 13:56
Download movies from vidmoly.
aria2c -x 5 $MasterM3U8URL
aria2c -x 5 -i master.m3u8
aria2c -x 20 -i index-v1-a1.m3u8
find ../seg-*.ts -print0 | sort -zV | xargs -0 cat > noCountryForOldMen.ts
ffmpeg -i noCountryForOldMen.ts -vcodec copy -acodec copy -bsf:a aac_adtstoasc noCountryForOldMen.mp4
@gokaybiz
gokaybiz / main.py
Last active October 7, 2022 23:14
pubhtml pdf book downloader
import requests
import re
import json
from os.path import realpath, dirname, exists
from os import makedirs
from shutil import rmtree
from PIL import Image
BASE_PATH = dirname(realpath(__file__))
@gokaybiz
gokaybiz / updateEncoding.sh
Created March 30, 2021 14:40
Change encodings of old windows files to utf-8 without unreadable characters. This will be day saver for old subtitles. windows-1254 => Turkish Windows Encoding
$ find . -name '*.txt' -exec iconv --verbose -f windows-1254 -t utf-8 -o {} {} \;
$ find . -name '*.srt' -exec iconv --verbose -f windows-1254 -t utf-8 -o {} {} \;
@gokaybiz
gokaybiz / fix.js
Last active March 3, 2021 06:03
Cytoscape.js custom style comma bug fixer
styles[19].style = Object.values(styles[19].style).map(obj => {
const pattern = /(\d*\,\d*)/g
let numsWithComma = [...(obj.selector).matchAll(pattern)]
console.log(numsWithComma)
if (numsWithComma.length > 0) {
Object.entries(obj.css).forEach(([key, value]) => {
if (value.toString().startsWith('mapData')) {
numsWithComma.forEach(([num]) => {
obj.css[key] = obj.css[key].replace(new RegExp(num, 'g'), num.replace(',', '.'))
})
@gokaybiz
gokaybiz / insert.py
Last active December 26, 2020 04:54
insert query builder
def sql_insert(cursor, table, dictionary):
columns = ','.join(dictionary.keys())
placeholders = ', '.join('?' * len(dictionary))
sql_cmd = "INSERT INTO {0} ({1}) VALUES ({2})".format(table, columns, placeholders)
return cursor.execute(sql_cmd, list(dictionary.values()))
#example usage
#gene_rows = {}
#gene_rows['gene_name'] = parsedCSVColumns['GeneSymbol']
@gokaybiz
gokaybiz / select.py
Created December 26, 2020 01:39
Example python mssql client
#https://datatofish.com/how-to-connect-python-to-sql-server-using-pyodbc/
import pyodbc
conn = pyodbc.connect('Driver={SQL Server};'
'Server=server_name;'
'Database=database_name;'
'Trusted_Connection=yes;')
cursor = conn.cursor()
cursor.execute('SELECT * FROM database_name.table')
@gokaybiz
gokaybiz / simpleDictionary.py
Created November 22, 2020 20:40
Simple dictionary script for unskilled someone's homework.
#! /bin/python
word_list_tr = {
"armut": "pear",
"mühendis": "engineer",
"aday": "candidate",
"niteliksiz": "unskilled",
"öğrenci": "schoolgirl",
"iş": "business",
"beceriksiz": "ineffectual"
@gokaybiz
gokaybiz / custom.js
Last active November 5, 2020 00:10
[Woocommerce Gallery] Disable pretty photo plugin and update main thumbnail with mini thumbnails on click
var thumbnail_list = jQuery('.woocommerce-product-gallery__image')
if (thumbnail_list.length > 0) {
var main_thumb = thumbnail_list.slice(0, 1)
thumbnail_list.slice(1).each(function() {
jQuery(this).children('a').contents().unwrap()
jQuery(this).on('click', function(e) {
e.preventDefault();
var thumb = jQuery(this).children()
var max_res = (thumb.attr('srcset').split(',')
.map(item => {