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
function Get-UidFromSid | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true,Position=0,ValueFromPipeline,ValueFromPipelineByPropertyName)] | |
[System.Security.Principal.SecurityIdentifier]$sid | |
) | |
Process { | |
# convert sid to byte array |
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 bash | |
# | |
# docker-gc - remove stopped docker containers and images | |
# | |
# inspired by: | |
# - https://forums.docker.com/t/command-to-remove-all-unused-images/20/2 | |
# - http://stackoverflow.com/a/24681946/576371 | |
docker ps -qaf status=exited | xargs docker rm | |
docker images -qf dangling=true | xargs docker rmi |
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
# Author: Maxim Doucet | |
# Date: 2016-04-01 | |
# docker machine and docker client to run docker in virtualbox with centos 6 | |
############################################################################### | |
# install it in $HOME | |
mkdir -p ~/local/docker | |
# download docker machine |
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 | |
"""Print shared library dependencies.""" | |
import subprocess | |
p = subprocess.Popen(['ldd', '/lib/libc.so.6', stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
output, errors = p.communicate() | |
print output |
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 bash | |
# | |
# Install git from source on RHEL and its derivative (Centos, ...) | |
# | |
# The idea is to not touch the system wide git (installed via yum). That's why | |
# we install it in the home directory. | |
# | |
# Also setup the man pages so that "${INSTALL_DIR}/bin/git commit --help" (for | |
# example) gives the $GIT_VERSION man page, not the original system man page. | |
# But see below for more explanation. |
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 | |
"""Print environment variables.""" | |
import os | |
# print environment variables | |
for k in os.environ: | |
print('%s: %s' % (k, os.environ[k])) | |
# print environment variables with alphabetical sort |
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 bash | |
# | |
# Install byobu from source | |
# | |
# Author: Maxim Doucet <[email protected]> | |
BYOBU_VERSION=5.112 | |
BUILD_DIR=/tmp/install_byobu | |
if ! mkdir -p "${BUILD_DIR}" ; then |