This file contains hidden or 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
The user `primary` is the user with the desktop access | |
The user `secondary` is a user you sudo/su to who you would like to run X11 apps | |
`x11-share` is a group that you create. All users who should share the xauth cookies should be in this group | |
**Note this is a security issue if you do not trust the `x11-share` users!!** | |
/etc/sudoers: | |
``` | |
Defaults:deploy env_keep += "XAUTHORITY", !requiretty | |
Defaults:deploy env_keep += "DISPLAY", !requiretty | |
``` |
This file contains hidden or 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
"" | |
McAfee EPO has no IPV4 value, what do I do !? | |
EPOComputerProperties has IPV6 value but no IPV4 value in certain versions or | |
configurations. Here is a quick function to "fix" that, since the IPv4 data | |
is often actually hidden inside a bogus IPV6 value. | |
McAfee EPO seems to return a phony IPv6 address, and has no IPv4 field when using | |
their API, specifically in this case, the core.executeQuery endpoint, when using | |
output=json (and probably csv, or whatever else) |
This file contains hidden or 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
package main | |
import ( | |
"bufio" | |
"io/ioutil" | |
"os/signal" | |
//"syscall" | |
"fmt" | |
"log" | |
"os" |
This file contains hidden or 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
#!/bin/bash | |
# | |
# This will download the latest Linux version of PyCharm, a tarball that works on Debian, Ubuntu, Fedora, etc, etc... | |
# You can just paste it into your terminal, put it in a shell script and execute it, our simply source it. | |
# | |
# - AG | |
# | |
# (Edited multiple times for quotes and other silly things) | |
# | |
# Dependencies: |
This file contains hidden or 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
""" | |
Taken from StackOverflow | |
This is the cleanest, most correct and thorough method I've seen | |
""" | |
def addLoggingLevel(levelName, levelNum, methodName=None): | |
""" | |
Comprehensively adds a new logging level to the `logging` module and the | |
currently configured logging class. |
This file contains hidden or 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
""" | |
A simple example of formatting log messages differently based on their | |
Python log level. It seems a basic feature for a logging library that | |
as far as I can tell is missing from stdlib logging | |
So the usual route is overriding the logging.Formatter class as shown | |
below. Sovling the problem this way isn't novel or unusual as nearly | |
all of the stdblib classes are meant to be extended, but it would | |
be nice if you could just pass a dictionary of log levels and their |
This file contains hidden or 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
class StupidFancyLogger(logging.Logger): | |
"""Extension of logging.Logger that has stupid fancyprint wrapper funcs | |
If you want your app to print stupid line prefixes and endings, this an | |
example of a way to do that. It's pretty simple, it just provides some | |
new methods in the Logger class, i.e., StupidFancyLogger.indented() | |
logger = StupidFancyLogger(...) | |
logger.indented(msg, count=8, log_level=logging.INFO): | |
""" |
This file contains hidden or 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
# | |
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license. | |
# | |
import ctypes | |
import logging | |
import os | |
class ColorizingStreamHandler(logging.StreamHandler): | |
# color names to indices | |
color_map = { |
This file contains hidden or 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
# | |
# | |
# ... | |
# The release target will do the following: | |
# - Bump your current *3 digit* git tag (you *MUST* be using x.y.z format) by git tagging | |
# `make release bump=major` | |
# `make release bump=minor` | |
# `make release` | |
# - Build/publish your Python package via setuptools, dynamically inserting the bumped | |
# version (so no need to update or track a version in setup.py) |
This file contains hidden or 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 python2 | |
# -*- coding: utf-8 -*- | |
""" | |
Retrieve list of all VyprVPN servers, relying on their publicly posted list which | |
is referenced on their site as an "official" source .. it seems this could change | |
but it hasn't in a long time | |
Dependency on BeautifulSoup | |
(Optional) dependency on the `progress` project @ https://pypi.org/project/progress/ |