This is a simple slackbot to post successful SSH logins to a slack channel to help you keep track of server access.
Create an incoming webhook for your slack community.
Create /etc/ssh/sshslack.sh
| #!/bin/bash -ex | |
| CURL_COMMAND='curl -X POST https://api.github.com/graphql' | |
| RAW_OUTPUT_FILE="$(tempfile -s ".query.output")" | |
| MINIMUM_PLUS_1_COUNT=20 | |
| function API_call() { | |
| if [ ! -v NEXT_PAGE ]; then | |
| api_output=$($CURL_COMMAND -H "Authorization:bearer $GITHUB_TOKEN" -d @query) | |
| else |
| :80 { | |
| root /serve | |
| } |
| # Calculate the latest and earliest offsets, and provide the total # of messages in the topic (the difference): | |
| #!/bin/bash | |
| if [[ $# -eq 0 ]] ; then | |
| echo 'provide the name of a topic to get totals against' | |
| exit 0 | |
| fi | |
| latest=`bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic $1 --time -1 --offsets 1 | awk -F ":" '{sum += $3} END {print sum}'` | |
| earliest=`bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic $1 --time -2 --offsets 1 | awk -F ":" '{sum2 += $3} END {print sum2}'` | |
| total=`expr $latest - $earliest` |
This is a simple slackbot to post successful SSH logins to a slack channel to help you keep track of server access.
Create an incoming webhook for your slack community.
Create /etc/ssh/sshslack.sh
| import os, argparse | |
| import tensorflow as tf | |
| from tensorflow.python.framework import graph_util | |
| dir = os.path.dirname(os.path.realpath(__file__)) | |
| def freeze_graph(model_folder): | |
| # We retrieve our checkpoint fullpath | |
| checkpoint = tf.train.get_checkpoint_state(model_folder) |
This was tested on a ThinkPad P70 laptop with an Intel integrated graphics and an NVIDIA GPU:
lspci | egrep 'VGA|3D'
00:02.0 VGA compatible controller: Intel Corporation Device 191b (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GM204GLM [Quadro M3000M] (rev a1)
A reason to use the integrated graphics for display is if installing the NVIDIA drivers causes the display to stop working properly.
In my case, Ubuntu would get stuck in a login loop after installing the NVIDIA drivers.
This happened regardless if I installed the drivers from the "Additional Drivers" tab in "System Settings" or the ppa:graphics-drivers/ppa in the command-line.
| #!/bin/bash | |
| function pause(){ | |
| read -p "$*" | |
| } | |
| RED='\033[0;31m' | |
| NC='\033[0m' # NOCOLOR | |
| YELLOW='\033[0;33m' | |
| function HexToDotted (){ |
| Step by step how to pull a private DockerHub hosted image in a Kubernetes YML. | |
| export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/ | |
| export DOCKER_USER=Type your dockerhub username, same as when you `docker login` | |
| export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login` | |
| export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login` | |
| kubectl create secret docker-registry myregistrykey \ | |
| --docker-server=$DOCKER_REGISTRY_SERVER \ | |
| --docker-username=$DOCKER_USER \ |
| #!/opt/datadog-agent/embedded/bin/python | |
| import os | |
| import sys | |
| import time | |
| import re | |
| import subprocess | |
| import logging | |
| # To keep this lightweight we assume the following |