This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
## | |
## Poll xrandr to find brightness of connected monitors, set if above threshold | |
## | |
## | |
## Place this file in /usr/bin/dell_xps_15_brightness, set it to executable, and link it: | |
## ln -s /usr/bin/dell_xps_15_brightness /lib/systemd/system-sleep | |
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIT License | |
Copyright (c) 2018 Noel Bundick | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os, string | |
def _pmap(process): | |
import subprocess | |
try: | |
p = subprocess.Popen(["pmap", process], stdout=subprocess.PIPE) | |
retval = [ x.decode() for x in p.stdout] | |
except OSError: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
def humanize_bibytes(n, prefixes=collections.OrderedDict(( | |
(0, 'B'), | |
(1024, 'KiB'), | |
(1048576, 'MiB'), | |
(1073741824, 'GiB'), | |
(1099511627776, 'TiB'), | |
(1125899906842624, 'PiB'), | |
(1152921504606846976, 'EiB'), | |
(1180591620717411303424, 'ZiB'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convertSize(size): | |
''' | |
reduce xxxK, xxxM, xxxG, etc | |
''' | |
if size.strip() == "": | |
size = 0 | |
elif size[-1] == 'K': | |
size = size*1024 | |
elif size[-1] == 'M': | |
size = size*1024*1024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
__author__ = 'Joshua M. Schmidlkofer <[email protected]>' | |
__credits__ = ["Joshua M. Schmidlkofer"] | |
__status__ = "Development" | |
__url__ = "https://gist.github.com/joshland/e89347f88d128a971768c2a711dfa5dc" | |
from collections import OrderedDict | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# fstab interpreter | |
__author__ = 'Jorge Niedbalski R. <[email protected]>' | |
__url__ = 'https://api.jujucharms.com/charmstore/v5/elasticsearch/archive/hooks/charmhelpers/core/fstab.py' | |
__note__ = 'small mod: change filter/lamba to listcomp, Joshua Schmidlkofer <[email protected]>' | |
__credits__ = ["Jorge Niedbalski R.", "Joshua Schmidlkofer"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here is a sample of how I am currently dealing with users. | |
Big thanks to uggedal! I used his user states as an example: https://github.com/uggedal/states | |
### | |
# How to create password hashes | |
### | |
python -c "import crypt; print crypt.crypt('password', '\$6\$SALTsalt\$')" | |
### |