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
class gitorious::example | |
case $operatingsystem { | |
CentOS: { | |
case $operatingsystemrelease { | |
/^5/: { | |
$package_list = ["monit", "memcached", "ImageMagick","gcc-c++","zlib-devel","make","wget","libxml2","libxml2-devel","libxslt","libxslt-devel","gcc","ruby-devel","openssl","curl-devel"] | |
} | |
default: { | |
$package_list = ["monit", "memcached", "ImageMagick","gcc-c++","zlib-devel","make","wget","libxml2","libxml2-devel","libxslt","libxslt-devel","gcc","ruby-devel","openssl","libcurl-devel"] | |
} |
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
# Traps for cleaning up on exit | |
# Originally from http://www.linuxjournal.com/content/use-bash-trap-statement-cleanup-temporary-files | |
declare -a on_sig_items | |
function on_exit() | |
{ | |
echo "Received SIGEXIT, Cleaning up: $i" | |
for i in "${on_sig_items[@]}"; do | |
echo "Executing cleanup statement: $i" | |
eval $i |
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
# Exit on failure function | |
function exit_on_fail { | |
echo "Last command did not execute successfully but is required to proceed!" >&2 | |
echo "Exiting and rolling back all changes!" >&2 | |
exit 1 | |
} | |
#USAGE EXAMPLE | |
sudo yum install puppet || exit_on_fail |
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
# Figure out OS | |
osfamily='Unknown' | |
apt-get help > /dev/null 2>&1 && osfamily='Debian' | |
yum help help > /dev/null 2>&1 && osfamily='RedHat' | |
if [ "${OS}" == 'SunOS' ]; then osfamily='Solaris'; fi | |
if [ `echo "${OSTYPE}" | grep 'darwin'` ]; then osfamily='Darwin'; fi | |
if [ "${OSTYPE}" == 'cygwin' ]; then osfamily='Cygwin'; fi | |
echo "Detected OS based on: ${osfamily}" | |
case ${osfamily} in | |
"RedHat") |
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
echo "satsrtrss" && bash |
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 run_as_root(func): | |
""" | |
A decorator to run a code block as the root user, assumes that user has | |
permissons to switch to root (see euid, ruid, suid) | |
""" | |
def inner(*args, **kwargs): | |
current_proc = multiprocessing.current_process() | |
logger.debug("Changing permissions for process: {0} with PID: {1}".format(current_proc.name, str(current_proc.pid))) | |
if sys.version > "2.7": | |
ruid, euid, suid = os.getresuid() |
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 set_uid_gid(set_rguid_to_eguid=False, set_eguid_to_rguid=False, restore_ids=True): | |
""" | |
A decorator to set/swap real/effective UID/GID for the duration of an operation | |
EUID: Effective user ID, this is what is used to check permissions | |
RUID: Real user ID, this is used to determine who the original user is | |
when escalating priv. to determine the original user | |
SUID: Saved user ID, this is used to store original user ID when a process | |
needs to temporarily deescalate it's priv but is used to re-escalate. | |
""" |
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
#include <Python.h> | |
#include <string.h> | |
/* | |
This program imports a Python module and checks for any instances of a | |
the predefined python class or instances of child classes. | |
Each instance is considered to represent a subcommand which will be made | |
available as a subcommand under this program. | |
Note that under no circumstances should the subcommands be spawned using | |
any shell or should shells be invoked due to security concerns. |
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
* Note that this layout is quite similar to Colekmak in many ways, once optimisations were done I fould that like with * Colemak moving the Z/X/C/V did not have a noticable impact but caused issues with shortcuts. | |
* The biggest difference is making sure vovels are easily used with accents/diacritics | |
* Keymap: Layer 0 with Gelatin keyboard layout | |
* Note that this layout requires a custom OS keyboard map to work correctly. | |
* Tertiary symbols are accessed using LAlt | |
* Deadkey functionality is used to combine accents/diacritics and alphabetic letters | |
* ,--------------------------------------------------. ,--------------------------------------------------. | |
* | +L1 | 1 !¡ | 2 @ | 3 # | 4 $ §| 5 % ˝|˘ ̑ ˚ | |˘ ̑ · | 6 ^ ̏| 7 & | 8 * | 9 + | 0 = | L0 | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| |
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
astevens@anthill:/var/snap/microk8s$ sudo snap refresh microk8s --channel=1.16/edge | |
microk8s (1.16/edge) v1.16.0-alpha.3 from Canonical✓ refreshed | |
astevens@anthill:/var/snap/microk8s$ microk8s.ctr --debug image pull --user user:pass docker.example.com/default_organization-example-docker:latest | |
DEBU[0000] fetching image="docker.example.com/default_organization-example-docker:latest" | |
DEBU[0000] resolving | |
DEBU[0000] do request request.headers=map[Accept:[application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, *]] request.method=HEAD url="https://docker.example.com/v2/default_organization-example-docker/manifests/latest" | |
DEBU[0000] fetch response received response.headers=map[Content-Type:[text/html; charset=iso-8859-1] Date:[Tue, 27 Aug 2019 1 |
OlderNewer