Skip to content

Instantly share code, notes, and snippets.

@brittbinler
brittbinler / run_eslint.sh
Created October 26, 2020 18:18 — forked from felippenardi/run_eslint.sh
Shell script to Run Eslint only on modified files
#!/bin/bash
CHANGED_FILES=`git diff origin/master...HEAD --name-only`
node_modules/eslint/bin/eslint.js -f json $CHANGED_FILES --quiet | node_modules/eslines/index.js --quiet
if [[ $? != 0 ]] ; then
echo "Fix style violations"
exit 1
fi
echo "All changed files are good"
@brittbinler
brittbinler / list_modules.py
Created January 7, 2019 22:18
List python modules
# Credit: https://stackoverflow.com/questions/1707709/list-all-the-modules-that-are-part-of-a-python-package/1707786
# this is the package we are inspecting -- for example 'email' from stdlib
import my_package
package = my_package
for importer, modname, ispkg in pkgutil.iter_modules(package.__path__):
print("Found submodule %s (is a package: %s)" % (modname, ispkg))
@brittbinler
brittbinler / pre-commit
Last active July 31, 2018 20:52
Commit hooks
#!/usr/bin/env python
## Source: https://coderwall.com/p/jp7d5q/create-a-global-git-commit-hook
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')

Keybase proof

I hereby claim:

  • I am brittbinler on github.
  • I am brittbinler (https://keybase.io/brittbinler) on keybase.
  • I have a public key ASAsQHC2M6zMbR3K3uau0dL4j9sUEJniL3XF2fwkLd1LGgo

To claim this, I am signing this object:

@brittbinler
brittbinler / docker bash
Last active April 24, 2018 17:22
Exec into Docker container and run bash
docker ps
docker exec -it <container name> /bin/bash
@brittbinler
brittbinler / Batch file conversion using Pandoc
Created April 7, 2018 14:51
Batch convert files in a directory from .docx to .pdf
# Install pandoc before running
find ./ -iname "*.docx" -type f -exec sh -c 'pandoc "${0}" -o "${0%.docx}.pdf"' {} \;
@brittbinler
brittbinler / glcoud.txt
Created October 5, 2017 19:47
frequent gcloud commands
gcloud config set account [service account email]
gcloud auth application-default print-access-token
@brittbinler
brittbinler / gist:2232c7b22e2c1319a73172f7ba7d58fd
Last active September 29, 2017 14:11
Bash open a new tab and run command
# Credit: https://stackoverflow.com/questions/7171725/open-new-terminal-tab-from-command-line-mac-os-x
# Alternative: https://www.npmjs.com/package/ttab
# Opens a new tab in the current Terminal window and optionally executes a command.
# When invoked via a function named 'newwin', opens a new Terminal *window* instead.
function newtab {
# If this function was invoked directly by a function named 'newwin', we open a new *window* instead
# of a new tab in the existing window.
local funcName=$FUNCNAME
@brittbinler
brittbinler / catalogbot.js
Created July 6, 2017 13:59 — forked from bcks/catalogbot.js
Cooper Hewitt Catalog Bot
var fs = require('fs'),
PDFDocument = require('pdfkit'),
async = require('async'),
ColorThief = require('color-thief'),
colorThief = new ColorThief();
var bookWidth = 430;
var bookHeight = 343;
say -f script.txt -o script.aiff
lame -m m script.aiff script.mp3
afplay test.mp3