Skip to content

Instantly share code, notes, and snippets.

View theunkohlbeck's full-sized avatar

Theun Kohlbeck theunkohlbeck

View GitHub Profile
@marjamis
marjamis / githubGraphQL.sh
Last active September 3, 2020 09:56
Github GraphQL bash script to loop through the results with a sample query.
#!/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
@Ocramius
Ocramius / Caddyfile
Last active March 11, 2024 22:14
Example docker + docker-compose + caddy + traefik setup that routes to multiple apps from one exposed HTTP port
:80 {
root /serve
}
@davewat
davewat / gist:b3c5c4a383d1d9d26df33ecbb6ddd668
Last active March 30, 2022 19:03
Kafka commands and scripts
# 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`
@jgamblin
jgamblin / readme.md
Last active October 5, 2022 10:55
Bot that posts SSH logins to slack.

SSH Slackbot

This is a simple slackbot to post successful SSH logins to a slack channel to help you keep track of server access.

Step 1

Create an incoming webhook for your slack community.

Step 2

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)
@alexlee-gk
alexlee-gk / configure_cuda_p70.md
Last active October 26, 2025 19:39
Use integrated graphics for display and NVIDIA GPU for CUDA on Ubuntu 14.04

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.

@jgamblin
jgamblin / wifi.sh
Created September 3, 2016 15:24
OSX Script To Check Wifi
#!/bin/bash
function pause(){
read -p "$*"
}
RED='\033[0;31m'
NC='\033[0m' # NOCOLOR
YELLOW='\033[0;33m'
function HexToDotted (){
@rkuzsma
rkuzsma / gist:b9a0e342c56479f5e58d654b1341f01e
Last active August 27, 2025 19:27
Example Kubernetes yaml to pull a private DockerHub image
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 \
@johnbuhay
johnbuhay / dogsitter.py
Created February 5, 2016 15:23
Restart Datadog agent automatically inside docker when python script detects integration changes
#!/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
@h4cc
h4cc / howto.md
Last active March 10, 2025 07:33
Getting Thumbnails / Previews of your RAW files in Ubuntu

Howto

Install these programms

sudo apt-get install gnome-raw-thumbnailer ufraw-batch

Try now if everything works, and your thumbnails show up. If not, try the following part.