Skip to content

Instantly share code, notes, and snippets.

Coding from home

David Schmidt d-schmidt

Coding from home
  • Germany
Block or report user

Report or block d-schmidt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
d-schmidt /
Last active May 3, 2019 — forked from fxsjy/
SimpleAuthServer: A IPv6 Python 3 SimpleHTTPServer with authentication
import base64
from http.server import HTTPServer
from http.server import SimpleHTTPRequestHandler
import socket
key = base64.b64encode(b"user:password")
class HTTPServerV6(HTTPServer):
address_family = socket.AF_INET6
d-schmidt /
Created Jul 18, 2018
A random Python list iterator without shuffle using the linear congruential generator (LCG) algorithm. A pseudorandom number generator producing all numbers < len(list) with a period == len(list) is created.
import random
import warnings
def __prime_factors(n):
Returns all the prime factors of a positive integer
factors = []
d = 2
d-schmidt /
Last active Jul 18, 2018
Simple HTML parsing with python requests and lxml
import requests
import lxml.html
t = requests.get("").text
html = lxml.html.fromstring(t)
links = html.xpath("//span/span[@class='pretty-bg']/a")
for link in links:
d-schmidt /
Last active Mar 19, 2017
request a praw reddit oauth authcode and refresh token
#!/usr/bin/env python3
import sys
import http.server
from urllib.parse import urlparse
import praw
import time
d-schmidt / OpenWithSublimeText3.cmd
Last active Feb 27, 2017 — forked from mrchief/OpenWithSublimeText2.bat
Add "Open with Sublime Text 3" to Windows Explorer Context Menu of folders
View OpenWithSublimeText3.cmd
@echo off
SET st3Path=c:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
d-schmidt / rangemap.go
Last active May 10, 2018
Simple golang RangeMap implementation for sorted, not overlapping ranges of integers (like IP address ranges). Elements are found using binary search.
View rangemap.go
package main
import (
type Range struct {
L int
U int
d-schmidt / memo.txt
Last active Jun 5, 2018
download app apk from Android phone and install it in emulator
View memo.txt
// 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/
// download apk to path
adb -d pull /data/app/ path/to/
d-schmidt /
Created Jan 16, 2017
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 /
Last active Mar 3, 2017
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
sender = ''
d-schmidt /
Created Oct 14, 2016
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;
You can’t perform that action at this time.