Skip to content

Instantly share code, notes, and snippets.

View kdart's full-sized avatar
🍎
Working for ERG at Apple

Keith Dart kdart

🍎
Working for ERG at Apple
  • Dartworks
  • Santa Clara, CA
View GitHub Profile
@kdart
kdart / gitdiff.sh
Last active September 22, 2018 23:04
Use [g]vimdiff as the diff tool in git.
#!/bin/sh
# shell wrapper to use gvimdiff and vimdiff as git differ.
# set up your ~/.gitconfig like this to use it:
#[diff]
# external = gitdiff.sh
#
#[pager]
@kdart
kdart / pywhich3.py
Last active September 4, 2018 02:58
Python 3 script that can tell you where a module is coming from when imported.
#!/usr/bin/env python3.7
"""
Uses the import machinery to locate a module and report what it found, such as
where the source file is.
"""
import sys
import os
import importlib
@kdart
kdart / pywhich2
Created March 22, 2015 18:33
Python script that will tell you exactly what and were a module path is imported from.
#!/usr/bin/python2
# Tell you which object, and what kind, is obtained by an import. This can also
# Will return errorlevel of 2 if object is not found.
from __future__ import print_function
import sys
import imp
@kdart
kdart / dirwatcher
Created March 10, 2015 07:34
Script to watch directory and launch hander.
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
"""
Watch for new downloads in ~/Downloads (or another directory) and take actions.
The actions are determined by the file extension (determining the mime type).
"""
from __future__ import absolute_import
from __future__ import print_function