Skip to content

Instantly share code, notes, and snippets.

@JavaScriptDude
JavaScriptDude / android-backup-apk-and-datas.md
Created Jan 19, 2022 — forked from AnatomicJC/android-backup-apk-and-datas.md
Backup android app, data included, no root needed, with adb
View android-backup-apk-and-datas.md

Backup android app, data included, no root needed, with adb

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Fetch application APK

To get the list of your installed applications:

@JavaScriptDude
JavaScriptDude / WkHtmlToX_JS_Debug.md
Last active Jan 9, 2022
Debugging JavaScript for WkHtmlToX
View WkHtmlToX_JS_Debug.md

WkHtmlToX projects uses WebKit as a backend to virutally render a web page and execute its JavaScript to get the final page for printing.

The issue is that the version of WebKit used is very old and this makes debugging JS regressions difficult. WkHtmlToX does offer a way to output the console, but it gives no way to do active debugging and provides no line numbers!

To debug JavaScript using the same WebKit version, I tracked down the version of Chromium that uses a close enough webkit version that this library leverages (534.34). Chromium 13.0.767.1, which is available here as a standalone exe for windows.

If your page does not already have a handler for window.onerror, add one with the following code in your page boot code.

// Detect old safari version used by QT and Chromium 13.0.767.1
if (naviagtor.userAgent.indexOf("Safari/534.3") > -1) {
@JavaScriptDude
JavaScriptDude / SingleInstanceChecker.py
Last active Feb 2, 2021
Cross Platform Example of Single Instance Checking in Python
View SingleInstanceChecker.py
import time, sys, os
class SingleInstanceChecker:
def __init__(self, id):
if isWin():
ensure_win32api()
self.mutexname = id
self.lock = win32event.CreateMutex(None, False, self.mutexname)
self.running = (win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS)
@JavaScriptDude
JavaScriptDude / library_template.js
Last active Nov 10, 2020
JS Template for making a Library that can be consumed by any system that Underscore.js supports (Browser, Node etc...)
View library_template.js
// JS Library Template
// This is tooled to not clobber any namespace with the exception of temp var $$LIBDEF$$
// Major boilerplate was swiped from underscore.js and modified to make it more universal
// Eg: $$LIBDEF$$ = { ns: '$Q', library: 'q_lib', version: '0.1.0'};
// This will load a library refereced by singleton $Q like: $Q.hiMom()
// Change as required
$$LIBDEF$$ = { ns: '$Q', library: 'q_lib', version: '0.1.0'};
// Boilerplate (BP) start
@JavaScriptDude
JavaScriptDude / Libreoffice_Python_scripting.md
Last active Dec 14, 2020
Editing xls spreadsheet from Python
View Libreoffice_Python_scripting.md

Installation

Linux package

sudo apt-get install python3-uno

Add python3 dist-packages to PYTHONPATH:

% dpkg-query -L python3-uno | grep dist

Add Dist Packages to PYTHONPATH in ~/.bashrc

Change this path as required % export PYTHONPATH=/usr/lib/python3/dist-packages