Skip to content

Instantly share code, notes, and snippets.

View d-schmidt's full-sized avatar
🏠
Coding from home

David Schmidt d-schmidt

🏠
Coding from home
  • Germany
View GitHub Profile
@d-schmidt
d-schmidt / memo.txt
Last active June 5, 2018 21:19
download app apk from Android phone and install it in emulator
// install and or goto adb
// download from device (usb) -d
// list full path of third party packages
adb -d shell pm list packages -f -3
// package:/data/app/com.google.android.inputmethod.japanese-1/base.apk=com.google.android.inputmethod.japanese
// download apk to path
adb -d pull /data/app/com.google.android.inputmethod.japanese-1/base.apk path/to/
@d-schmidt
d-schmidt / chrome_history_clean.py
Created January 16, 2017 14:52
Cleaning the Chrome browser history with Python
#!/usr/bin/env python3
import sqlite3
import re
# find your 'History' file
conn = sqlite3.connect('c:/Users/username/AppData/Local/Google/Chrome/User Data/Default/History')
c = conn.cursor()
print("history length", c.execute('SELECT count(1) FROM urls').fetchone()[0])
@d-schmidt
d-schmidt / sendEmail.py
Last active March 3, 2017 13:49
sending text mails from python with text attachments
#!/usr/bin/env python3
# this is python 2 and 3 compatible
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import datetime
COMMASPACE = ', '
sender = 'sender@example.com'
@d-schmidt
d-schmidt / Bundler.java
Created October 14, 2016 21:13
a simple wrapper around android.os.Bundle to fluently build bundles
package pw.dschmidt.helper;
import android.os.Bundle;
public class Bundler {
private Bundle bundle;
@d-schmidt
d-schmidt / chrome.js
Last active February 4, 2021 12:30
clear current (filtered) chrome history page using F12 console
// copy paste and enter to clear current page
for (i = 0; i < 150;i++) document.getElementById("checkbox-" + i).checked = true;
document.getElementById("remove-selected").disabled = false;
document.getElementById("remove-selected").click();
document.getElementById("alertOverlayOk").click();
@d-schmidt
d-schmidt / brntool.py
Last active April 27, 2016 17:40
reading flash from Arcadyan/o2 IAD 6431 1.01.25b
#!/usr/bin/python
# -*- coding: utf-8 -*-
# see https://github.com/rvalles/brntool
#Keep python2 working
from __future__ import division #1/2 = float, 1//2 = integer
from __future__ import print_function #print("blah", file=whatever)
#Keep python2 working end
from optparse import OptionParser
import serial
import sys
@d-schmidt
d-schmidt / redirectExample.go
Last active March 12, 2024 08:04
How to redirect HTTP to HTTPS with a golang webserver.
package main
import (
"net/http"
"log"
)
func redirect(w http.ResponseWriter, req *http.Request) {
// remove/add not default ports from req.Host
target := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {
@d-schmidt
d-schmidt / fixwinpath.go
Last active October 14, 2016 21:16
Circumvent 260 MAX_PATH charlength in Windows API in golang
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath
// http://stackoverflow.com/questions/1880321/why-does-the-260-character-path-length-limit-exist-in-windows
// converts a relative path like "abc\" or a filename like "savehere.zip"
// to full escaped path \\?\c:\currentdir\abc\
// note that all slashes have to be backslashes
func FuckWin(path string) string {
pwd, err := os.Getwd()
if err != nil { panic(err) }
result := pwd + "\\" + path
import random
import __future__
a = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWYXZ23456789$%&()=?+#-}][{*/:<>~' #0Ol1!I
b = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWYXZ23456789'
d = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWYXZ23456789@#%_-&*()'
all = "".join((chr(i) for i in range(33,127)))
def doa(l = 20, chars = a):
return "".join(chars[int(random.random() * (len(chars[:-1])+1))] for i in range(l))