Skip to content

Instantly share code, notes, and snippets.

bf4648 /
Created Apr 27, 2020 — forked from tywkeene/
Encrypt files and directories securely with pgp/tar/gzip/shred all in a small shell script
#!/usr/bin/env bash
set -e
function yesno() {
read -p "$1 Continue? (y/n): "
case $(echo -e "$REPLY" | tr '[A-Z]' '[a-z]') in
y|yes) echo "yes" ;;
*) echo "no" ;;
#!/usr/bin/env bash
set -euo pipefail
tmpdir=$(mktemp -d)
echo "tmpdir: $tmpdir"
read -r width height < <(pdfinfo $1 | grep "Page size:" | sed 's/[a-zA-Z: ]*\([0-9]\+\)[x ]*\([0-9]\+\).*/\1 \2/')
npages=$(pdfinfo $1 | grep "Pages:" | sed 's/Pages: \+\([0-9]\+\).*/\1/')
echo "page count: $npages"
echo "(width, height) = ($width, $height)"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Based on pdfcrop.pl_. Uses the BoundingBox [#]_
- PyPDF2_
bf4648 /
Created May 22, 2020 — forked from iwong/
Squid Setup

Squid Setup


# brew install squid2

Update squid conf

# vim /usr/local/Cellar/squid2/2.7.9/etc/squid.conf
bf4648 / incremental_tags.vim
Created May 25, 2020 — forked from Flolagale/incremental_tags.vim
Generate ctags incrementally in vim. Juste paste this into your .vimrc.
View incremental_tags.vim
function! GenerateTagsIncrementally()
python << EOF
import os
print('Generating tags incrementally.')
# Walk the file tree, if a file has an mtime more recent than the tag file,
# add it to the list of files to index.
tags_mtime = os.stat('tags').st_mtime
with open('list', 'w') as fp:
for dirpath, dirnames, filenames in os.walk(os.getcwd()):
for filename in filenames:
View mac-network-commands-terminal
Mac Network Commands Cheat Sheet
After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty.
Get an ip address for en0:
ipconfig getifaddr en0
Same thing, but setting and echoing a variable:
bf4648 /
Created Jul 1, 2020 — forked from vinovator/
A sample code which uses pdfminer module to extract text from pdf files
# Python 2.7.6
# For Python 3.x use pdfminer3k module
# This link has useful information on components of the program
''' Important classes to remember
PDFParser - fetches data from pdf file
bf4648 /
Created Jul 3, 2020 — forked from wolframalpha/
Please add this to your code and report!
import os
import subprocess
import shlex
import time
def convert_doc_to_pdf(ipfile_path, opfile_path):
subprocess.Popen(shlex.split('libreoffice --headless --convert-to pdf "{}" --outdir "{}"'.format(ipfile_path, opfile_path)), stdout=True)
bf4648 / tmux.conf
Created Jul 24, 2020 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
View tmux.conf
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
brew install docker
brew install docker-machine
brew services start docker-machine
brew install virtualbox # Requires SystemPreferences intervention
docker-machine create default --virtualbox-cpu-count 6 --virtualbox-memory 8192
# Create "docker" group and put me in it
sudo dseditgroup -o create docker
sudo dseditgroup -o edit -a price -t user docker
You can’t perform that action at this time.