Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
extended working from home...

Peter Mescalchin magnetikonline

🏡
extended working from home...
View GitHub Profile
@eyecatchup
eyecatchup / pdf2docx.py
Last active Jun 9, 2020
Convert PDF files to Microsoft Office Word compatible doc/docx files, using LibreOffice's command line interface.
View pdf2docx.py
#!C:/Python27/python.exe
#
# Convert PDF files to Microsoft Office Word compatible doc/docx files,
# using LibreOffice's command line interface.
#
# http://stackoverflow.com/questions/26358281/convert-pdf-to-doc-python-bash
# http://ask.libreoffice.org/en/question/20111/converting-files-using-soffice-convert-to-with-embedded-images-html-to-doc/
# http://cgit.freedesktop.org/libreoffice/core/tree/filter/source/config/fragments/filters
#
@firstdoit
firstdoit / nodejs-ubuntu-bind-port-80.md
Last active Jul 30, 2020
Allow Node.js to bind to privileged ports without root access on Ubuntu
View nodejs-ubuntu-bind-port-80.md

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@psebborn
psebborn / countCSSRules.js
Last active Jan 8, 2020
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
View countCSSRules.js
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@cdown
cdown / gist:1163649
Last active Aug 7, 2020
Bash urlencode and urldecode
View gist:1163649
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
You can’t perform that action at this time.