Skip to content

Instantly share code, notes, and snippets.

View glowinthedark's full-sized avatar

glowinthedark glowinthedark

  • URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
  • HTTPError: HTTP Error 403: Forbidden
View GitHub Profile
glowinthedark /
Last active April 9, 2019 13:55
PoiWordToTextConverter — minimal POI-based word to text converter (DOC, DOCX)
// should go into the `src` folder relative to the `pom.xml` file
import org.apache.poi.POITextExtractor;
import org.apache.poi.extractor.ExtractorFactory;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.xmlbeans.XmlException;
glowinthedark / nocss.js
Created April 11, 2019 18:29
Browser bookmarklet to remove all styles
View nocss.js
javascript:(function(){for(i=0;i<document.styleSheets.length;i++){document.styleSheets.item(i).disabled=true;}all=document.getElementsByTagName('*');for(i=0;i<all.length;i++){var s=all[i].style;s.cssText='';s.width='';s.padding='1px';s.margin='1px';s.fontSize='12pt';s.lineHeight='150%';if(s.position=='absolute'||s.position=='relative'||s.position=='fixed')s.position='static';}var;st.paddingLeft='100px';st.paddingRight='100px';st.backgroundImage='none';st.backgroundColor='#fff';st.color='#000';})()
glowinthedark /
Created April 11, 2019 18:30
Python Example Web Service using suds and lxml
import suds
import sys
import lxml.etree as etree
def xml_pretty_print(doc):
return etree.tostring(doc, pretty_print = True)
url = ""
# get ticker symbol as command line arg or use default
glowinthedark / Export-OSX-Notes-to-HTML.applescript
Created April 11, 2019 18:31
Export notes from the OSX to separate HTML files prefixed with the creation timestamp.
View Export-OSX-Notes-to-HTML.applescript
on buildTitle(originalText)
set normalizedText to my replace(originalText, ":", "-")
set normalizedText to my replace(normalizedText, "|", "")
set normalizedText to my replace(normalizedText, "{", "")
set normalizedText to my replace(normalizedText, "}", "")
set finalTitle to my firstChars(normalizedText, 30)
return finalTitle
end buildTitle
on replace(originalText, fromText, toText)
glowinthedark /
Created April 11, 2019 18:32
SimpleAuthServer: A SimpleHTTPServer with authentication
#!/usr/bin/env python
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import sys
import base64
import socket
glowinthedark /
Created April 11, 2019 18:33
Bash Tea-timer
#!/usr/bin/env bash
mpv --no-terminal $DRIP && notify-send -t 1 "TEA" "Started at: $(date +'%A, %d-%B-%y, %H:%M:%S')" --icon=dialog-information
declare -A ticks=( \
[50]="50 sec" \
[20]="1 min 10 sec" \
[20]="1 min 30 sec" \
glowinthedark /
Created April 11, 2019 18:39
GMail IMAP4 reader (IMAP has to be enabled in Gmail > Settings)
#!/usr/bin/env python
# Run without args to get message headers for the last 3 days.
# 10 - display message headers for the last 10 days.
# 10 full - display message headers with bodies.
import sys
import os
import imaplib
import getpass
glowinthedark / javascript-reduce-example.js
Created June 13, 2019 14:52
javascript reduce example
View javascript-reduce-example.js
var args = {
quoted_prop1: " oneEE",
quoted_prop1aaaa: " first level another",
quoted_I18N__prop2: " tWo (must be under I18N)",
quoted_I18N__weprop2bbb: " tWo and a half (must be under I18N)",
quoted_API__JUJUJ__prop3: " THREE",
quoted_API__JUJUJ__prop3BBBB: " THREE--beeee",
quoted_API__JUJUJ__LAST__prop3ZZZZ: " THREE--zzzzz",
quoted_API__prop4: " __FOUR__",
quoted_prop3232aaaa: " more first level another",
glowinthedark / bottle file server
Created July 6, 2019 22:57
Python Bottle file server with directory index
View bottle file server
#!/usr/bin/env python3
import os
import sys
import bottle
from bottle import run, static_file
def resolve_path(path):
glowinthedark /
Created August 14, 2019 17:32
apktool installer
# Get latest version from
export APKTOOL_VERSION=2.4.0
sudo -E sh -c 'wget$APKTOOL_VERSION.jar -O /usr/local/bin/apktool.jar'
sudo chmod +r /usr/local/bin/apktool.jar
sudo sh -c 'wget -O /usr/local/bin/apktool'
sudo chmod +x /usr/local/bin/apktool