Skip to content

Instantly share code, notes, and snippets.

@achennu
achennu / automount
Created May 11, 2015 19:32
auto mount and unmount cifs shares
# from http://ubuntuforums.org/archive/index.php/t-375563.html
#!/usr/bin/env python
'''
This script assumes that all the network shares in /etc/fstab are accessible
to the current user. In addition, the shares need to be CIFS (not SMBFS) in
order to correctly allow unmounting by the user in the event the share is
disconnected. /sbin/mount.cifs & /sbin/umount.cifs must be suid root.
#!/usr/bin/env python
"""Count imports in *.py files in a given directory recursively.
Each name is counted once per file.
"""
import ast
import os
import sys
from collections import Counter