Skip to content

Instantly share code, notes, and snippets.

@florido
florido / bashstyle.md
Created November 22, 2018 19:15 — forked from outro56/bashstyle.md
Bash scripting best practices (copied from https://github.com/progrium/bashstyle/blob/master/README.md)

progrium/bashstyle

Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne

@florido
florido / README.md
Created November 22, 2018 14:57 — forked from mbbx6spp/README.md
Best UNIX shell-based tools I can't live without with example usages

Best UNIX Shell tools

These are a list of usages of shell commands I can't live without on UNIX-based systems.

Install

Mac OS X

Using Homebrew (yes, I am opinionated) you can install the following tools with the following packages:

@florido
florido / ocr-screenshot.sh
Last active November 22, 2018 08:22 — forked from pnc/ocr-shot.sh
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@florido
florido / videosubscriptionsd-process.md
Last active November 22, 2018 03:08
High CPU Usage on macOS from videosubscriptionsd Process

I ran log and grepped for "videosubscriptionsd" process. I found that it seemed near every log output for it there was Dropbox referenced either above or below. After stopping Dropbox, the problem went away.

Dropbox: (LaunchServices) [http://com.apple .launchservices.default] Local database thinks system build version is <private>, but the OS really is <private>.

Right above that I got this line:

videosubscriptionsd: Received distnoted matching event
@florido
florido / clear-font-cache.md
Created November 22, 2018 02:30 — forked from jaredhowland/clear-font-cache.md
Clear Mac OS X Font Caches
@florido
florido / homebrew-pip.md
Last active November 22, 2018 01:00 — forked from Daeinar/gist:4383663
Install pip packages with homebrew

Install pip packages with homebrew:

Install the brew-pip package brew install brew-pip

Add Homebrew's pip path to your PYTHONPATH environment variable (you probably should add this to some sort of shell initialization file like ~/.bashrc or ~/.zshrc) export PYTHONPATH=$(brew --prefix)/lib/python2.7/site-packages

Now install any pip packages with Homebrew! brew pip Glances

@florido
florido / uninstall-haskell-osx.sh
Created November 21, 2018 23:21 — forked from gatlin/uninstall-haskell-osx.sh
Uninstall Haskell from Mac OS X
#!/bin/bash
# source: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090170.html
sudo rm -rf /Library/Frameworks/GHC.framework
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
sudo rm -rf /Library/Haskell
rm -rf .cabal
rm -rf .ghc
rm -rf ~/Library/Haskell
@florido
florido / brews
Created November 21, 2018 23:10 — forked from jm3/Brewfile.md
brews + casks
ack
dos2unix
coreutils
figlet
git
gnupg
iftop
lynx
memcached
nload
@florido
florido / mac-setup-script.sh
Created November 11, 2018 13:33
[Mac Setup Script] #mac #install #configure
# Complete macOS Setup
# From clean install to fully configured.
# Step 1: Init Environment
#Temporarily Disable sudo Password Timeout
#The sudo password timeout is re-enabled at the end of this script. ##+BEGIN_SRC sh sudo tee /etc/sudoers.d/timeout > /dev/null <<-EOF Defaults timestamp_timeout=-1 EOF ##+END_SRC
##+BEGIN_SRC sh sudo tee /etc/sudoers.d/installer > /dev/null <<-EOF %admin ALL=(ALL) NOPASSWD:SETENV: /usr/sbin/installer EOF ##+END_SRC
@florido
florido / fixpaths.sh
Created November 11, 2018 09:14 — forked from erluko/fixpaths.sh
Fix the mess that /usr/libexec/path_helper made of my $PATH
#!/bin/sh
#Reorders $PATH, removes duplicates
prefixes="$1"
if [ '--' = "$prefixes" ]; then
shift;
prefixes="$1";
else
if echo "$prefixes" | grep -q '^\(\|--help\|-h\)$' ; then