Skip to content

Instantly share code, notes, and snippets.

View magnetikonline's full-sized avatar
💡
I have an idea!

Peter Mescalchin magnetikonline

💡
I have an idea!
View GitHub Profile
@jnovack
jnovack / Makefile
Last active November 23, 2020 03:35
bash_completion on OSX without Homebrew
all:
@echo "WARNING: Installation requires your sudo access, please enter your password when prompted."
@echo " ... press Enter to continue... "
@read
curl -LOs https://src.fedoraproject.org/repo/pkgs/bash-completion/bash-completion-1.3.tar.bz2/a1262659b4bbf44dc9e59d034de505ec/bash-completion-1.3.tar.bz2
curl -LOs https://raw.githubusercontent.com/Homebrew/formula-patches/c1d87451da3b5b147bed95b2dc783a1b02520ac5/bash-completion/bug-740971.patch
curl -LOs https://gist.githubusercontent.com/jnovack/e66f40e7a31e04f909c2f503c6df7367/raw/287b97a1f24bb47746248a15659b9478e6ec8e02/osx.patch
curl -LOs https://gist.github.com/jnovack/e66f40e7a31e04f909c2f503c6df7367/raw/SHA256SUMS
shasum -c SHA256SUMS || (@echo "There was an error downloading one or more files... please try again."; exit 1)
tar -xzvf bash-completion-1.3.tar.bz2
@eyecatchup
eyecatchup / pdf2docx.py
Last active May 14, 2021 20:39
Convert PDF files to Microsoft Office Word compatible doc/docx files, using LibreOffice's command line interface.
#!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
#
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
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) {
@guifromrio
guifromrio / nodejs-ubuntu-bind-port-80.md
Last active January 10, 2024 22:47
Allow Node.js to bind to privileged ports without root access on Ubuntu

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:

@cdown
cdown / gist:1163649
Last active February 3, 2024 18:49
Bash urlencode and urldecode
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
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active March 28, 2024 13:44 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy