Skip to content

Instantly share code, notes, and snippets.

View nexus166's full-sized avatar
🌪️
🐧

nexus166

🌪️
🐧
  • Earth
View GitHub Profile
#!/usr/bin/env bash
set -eo pipefail +vx
DOCKER_CONFIGJSON=${DOCKER_CONFIGJSON:-~/.docker/config.json}
[[ ! -f "${DOCKER_CONFIGJSON}" ]] && printf 'Error: config.json not found' && exit 2
DOCKER_REGISTRY=${1:-${DOCKER_REGISTRY:-'https://index.docker.io/v1/'}}
[[ -z "${DOCKER_REGISTRY}" ]] && printf 'Usage:\n\t./%s $DOCKER_REGISTRY\n\nWill read credentials from %s' "$(basename $0)" "${DOCKER_CONFIGJSON}" && exit 127
#!/usr/bin/env bash
set -eo pipefail +vx
export USERNAME="${REG_USR}"
export PASSWORD="${REG_PASS}"
case "${USERNAME}" in
"") export USERNAME="$(jq -cr '.auths."https://index.docker.io/v1/".auth' ~/.docker/config.json | base64 --decode | cut -d':' -f1)";;
esac
#!/usr/bin/env bash
set -e +vx
_WORD=$(shuf -n1 "${WORDLIST:-/usr/share/dict/words}" 2>/dev/null | tr -cd "[[:alpha:]]");
[[ -z "${_WORD}" ]] && _WORD="$(tr -cd '[:alpha:]' < /dev/urandom | fold -w10 | head -1)"
case "${1}" in
*h) echo -e "Usage:\\t$(basename $0) (-u|-U|-l)";;
*u) echo "${_WORD^}";;
#!/usr/bin/env bash
set -x
eval $(< /etc/os-release)
set +x
_os="$(printf '%s' ${ID} | tr '[[:upper:]]' '[[:lower:]]')"
_version="$(printf '%s' "${VERSION}" | awk -F'[()]' '{print tolower($2)}' | cut -d' ' -f1)"
#!/usr/bin/env bash
set +xv -eo pipefail
enabled=
for _dev in $(realpath /sys/bus/usb/devices/*/power/wakeup); do
state="$(< ${_dev})";
printf "[%s]\t%s\n" "${state}" "${_dev}";
if [[ "${state}" == "enabled" ]]; then
package main
import (
"fmt"
"log"
"net/http"
"strconv"
)
const (

docker/docker-py#1502 (comment)

pi@x:~/jenkins$ docker-compose up -d
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 6, in <module>
    from compose.cli.main import main
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 17, in <module>                                                                   
    import docker
  File "/usr/local/lib/python2.7/dist-packages/docker/__init__.py", line 2, in <module>                                                                     
python -c "import os,base64; print base64.urlsafe_b64encode(os.urandom(32))"
#!/usr/bin/env bash
set -eo pipefail
[[ $(id -u) -ne 0 ]] && echo "Need to run as root" && exit 2
_sping() {
SUBNET="$1";
TIMEOUT=${2:-2};
set +x
@nexus166
nexus166 / rocketchat_emoji_upload.sh
Last active August 6, 2019 14:44
bash upload custom emojis to Rocket.Chat
#!/usr/bin/env bash
: '
Get your yamls at https://github.com/amtypaldos/rocketchat-emoji-upload#emoji-packs
Create Personal Access Token at https://rocketchat.example.com/account/tokens
Usage: ./rocketchat_emoji_upload.sh $LINK_TO_YAML $RC_URL $RC_AUTHTOKEN $RC_USERID
Details https://rocket.chat/docs/developer-guides/rest-api/emoji-custom/