Skip to content

Instantly share code, notes, and snippets.

View bodsch's full-sized avatar

Bodo Schulz bodsch

View GitHub Profile
@bodsch
bodsch / download-latest-jenkins-artifact.py
Created November 8, 2023 06:36 — forked from jmcgeheeiv/download-latest-jenkins-artifact.py
Download the latest successful build artifacts from Jenkins using Python 3
#!/usr/bin/env python3
# Download the latest successful build artifacts from Jenkins using Python 3
# John McGehee 1/25/2016
#
# Based on the Python 2 version by supertom: https://gist.github.com/supertom/2759847
import argparse
import codecs
import io
import json
@bodsch
bodsch / install-minicube.sh
Last active September 8, 2023 07:15
minikube
#!/usr/bin/env bash
set -e
[ -d configs ] || mkdir configs
MK=$(command -v minikube)
minikube_start() {
@bodsch
bodsch / python-dns.py
Last active April 18, 2023 10:25
python script for DNS resolve
#!/usr/bin/env python
import dns.exception
# from dns.exception import DNSExcept
from dns.resolver import Resolver
def dns_lookup(input, timeout=3, server=[]):
"""
Perform a simple DNS lookup, return results in a dictionary
"""
@bodsch
bodsch / gist:e3a8fdb2f55d662211346c66e29d3001
Created November 5, 2022 14:50 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@bodsch
bodsch / Docker-client-config-json.md
Created October 25, 2022 03:49 — forked from devops-school/Docker-client-config-json.md
How to Configure Docker client with a configuration file?

Following is a sample config.json file:

{
  "HttpHeaders": {
    "MyHeader": "MyValue"
  },
  "psFormat": "table {{.ID}}\\t{{.Image}}\\t{{.Command}}\\t{{.Labels}}",
  "imagesFormat": "table {{.ID}}\\t{{.Repository}}\\t{{.Tag}}\\t{{.CreatedAt}}",
  "pluginsFormat": "table {{.ID}}\t{{.Name}}\t{{.Enabled}}",
@bodsch
bodsch / diff_side_by_side.py
Created October 24, 2022 13:45 — forked from jlumbroso/diff_side_by_side.py
Side-by-Side Diff Comparison in Python
# Code licensed LGPLv3 by Jérémie Lumbroso <lumbroso@cs.princeton.edu>
import difflib
import itertools
import textwrap
import typing
def side_by_side(
left: typing.List[str],
@bodsch
bodsch / check_redis.py
Created September 5, 2022 17:49 — forked from luanntvn/check_redis.py
Redis health and memory check for Nagios
#!/usr/bin/python
#
# LICENSE: MIT
#
# Copyright (C) 2014 Samuel Stauffer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation
@bodsch
bodsch / ansible_replace_the_value_of_dic_variable.yaml
Created February 15, 2022 04:07 — forked from hatsari/ansible_replace_the_value_of_dic_variable.yaml
ansible replace the value of dictionary variable
---
### ref: https://stackoverflow.com/questions/48825583/in-ansible-how-do-you-change-a-existing-dictionary-hash-values-using-a-variable
- name: replace the value of dictionary variable
hosts: localhost
gather_facts: no
vars:
fact_process:
cmd_check: ok
cmd_name: node1
cmd_status: error
#!/usr/bin/env python3
import docker
import json
# import urllib.request
# client = docker.from_env()
client = docker.DockerClient(base_url='unix://var/run/docker.sock')
#!/usr/bin/env bash
# delete dead containers
docker container prune -f
# keep last 2 builds for each image from the repository
for diru in $(docker images \
--format "{{.Repository}}" | sort | uniq)
do
for dimr in $(docker images \