Skip to content

Instantly share code, notes, and snippets.

View divadsn's full-sized avatar
🎯
Focusing

David Sn divadsn

🎯
Focusing
  • Krakow, Poland
  • 06:17 (UTC +02:00)
View GitHub Profile
@divadsn
divadsn / clearlogs.py
Last active November 6, 2020 17:31
Shitty python script to delete old VM logs
#!/usr/bin/env python3
import os
import argparse
rootdir = "/var/log/pve/tasks"
logfiles = {
"active": [],
"index": []
}
@divadsn
divadsn / extractor.py
Last active April 4, 2020 14:29
Proof of concept extractor script for cda.pl video links, reverse engineered from updated player.js
import json
import urllib.request
from urllib.parse import unquote
from bs4 import BeautifulSoup
def decrypt(a: str):
a = unquote(a.replace("_XDDD", ""))
b = []
@divadsn
divadsn / fuckmagisk.json
Last active March 29, 2020 10:49
Use this as custom version for Magisk Manager to prevent notification spam for the new ugly version.
{
"app": {
"version": "7.5.1",
"versionCode": "267",
"link": "https://github.com/topjohnwu/Magisk/releases/download/manager-v7.5.1/MagiskManager-v7.5.1.apk",
"note": "https://raw.githubusercontent.com/topjohnwu/Magisk/7db523071d662dcc8eb187e3cbae141c716ba045/app/src/main/res/raw/changelog.md"
},
"uninstaller": {
"link": "https://github.com/topjohnwu/Magisk/releases/download/v20.4/Magisk-uninstaller-20200323.zip"
},
@divadsn
divadsn / lumberkek.py
Created October 8, 2019 22:32
Basically I had too much time again with Python...
import time
from mss import mss
from PIL import Image
from pynput.keyboard import Key, Controller
keyboard = Controller()
sct = mss()
# check for any "brown" pixel
def check_tree(pixels, x, y):
@divadsn
divadsn / runscript.sh
Created September 19, 2019 23:53
Script to run GTA IV with older Wine version. Usage: runscript.sh LaunchGTAIV.exe
#!/bin/bash
export WINEPREFIX=~/.local/share/wineprefixes/GTAIV
export WINEARCH=win32
winepath=$(readlink -f ~/.local/share/wine/4.11_win32)
if [ ! -d $winepath ]; then
echo "Could not find wine-4.11 installation at $winepath, quitting..."
exit 1
fi
@divadsn
divadsn / override-dll.reg
Created August 20, 2019 15:12
mfc42 manual installation, taken from PlayOnLinux scripts.
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\DllOverrides]
"*mfc42"="native"
"*mfc42u"="native"
@divadsn
divadsn / secure_filename.py
Created March 2, 2019 02:39
Normalize and remove illegal characters in filenames in Python.
import string
import unicodedata
INVALID_FILE_CHARS = '/\\?%*:|"<>' # https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words
def secure_filename(filename):
# keep only valid ascii chars
output = list(unicodedata.normalize("NFKD", filename))
# special case characters that don't get stripped by the above technique
@divadsn
divadsn / docker-android.md
Last active December 9, 2018 10:23
Building Android using a pre-built Docker image on Linux or macOS (or even Windows).

Introduction

In this guide, I will show you how to deploy and run a pre-built build environment using Docker.
This guide is tested to run on Linux and macOS, but it should also work on Windows.

You are a pr0 thug dev and you only need the docker instruction? Click here.

Prerequisites

Your build machine should at least follow the minimum specs for building Android:

  • CPU: 4 cores with 2 GHz
  • Memory: 8 GB (recommended 12 GB if running with graphical environment)
@divadsn
divadsn / local_storage.js
Created September 5, 2018 18:40
Proof of Concept, WIP.
Storage.prototype.setItem = function(key, value) {
AndroidLocalStorage.setItem(key, value);
}
Storage.prototype.getItem = function(key) {
AndroidLocalStorage.getItem(key);
}
# http://www.nateware.com/linux-network-tuning-for-2013.html
# Increase Linux autotuning TCP buffer limits
# Set max to 16MB for 1GE and 32M (33554432) or 54M (56623104) for 10GE
# Don't set tcp_mem itself! Let the kernel scale it based on RAM.
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.core.optmem_max = 40960