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
#!/bin/bash | |
# spins up a new gitlab ci group exporter given a token to monitor ci pipelines for a gitlab group | |
# by: Cody Kochmann | |
GROUP_NAME=icody | |
CONTAINER_NAME=$GROUP_NAME-ci-exporter | |
CONFIG_DIR=/etc/gitlab-ci-pipelines-exporter | |
CONFIG_PATH=$CONFIG_DIR/config.yml |
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
# by: Cody Kochmann | |
import queue | |
def pop_min(*iterators): | |
q = queue.PriorityQueue() | |
for i in iterators: | |
normalized_i = iter(i) | |
q.put((next(normalized_i), normalized_i)) |
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
>>> # by: Cody Kochmann | |
>>> import random, string, queue | |
>>> pq = queue.PriorityQueue() | |
>>> chars = list(string.ascii_letters) | |
>>> chars | |
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] | |
>>> random.shuffle(chars) | |
>>> chars | |
['a', 'f', 'Y', 'h', 's', 'r', 'T', 'N', 'H', 'e', 'c', 'n', 'd', 'v', 'S', 'U', 'z', 'j', 'Q', 'x', 'J', 'p', 'E', 'm', 'C', 'u', 'V', 'F', 'D', 'P', 'k', 'y', 'X', 'L', 'w', 'G', 'i', 'W', 'I', 't', 'o', 'b', 'B', 'R', 'A', 'K', 'M', 'l', 'Z', 'O', 'g', 'q'] | |
>>> for c in chars: # put the chars as the priority |
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
''' | |
example input | |
[1, 3, 5, 9] | |
[2, 4, 4, 8] | |
output | |
[1, 2, 3, 4, 4, 5, 8, 9] |
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
#!/bin/bash | |
# by: Cody Kochmann | |
# set up auto cleanup of files in gitlab-runner's home that are older than 1 week | |
echo 'D /home/gitlab-runner 0755 gitlab-runner gitlab-runner 1w -' | tee -a /usr/lib/tmpfiles.d/home.conf | |
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
#!/bin/bash | |
sudo apt-get install pkg-config libssl-dev |
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
#!/bin/bash | |
# flashes sd cards with debian testing's daily build for raspberry pi 4 | |
# by: Cody Kochmann | |
for i in "$@" | |
do | |
echo "about to flash - $i" >&2 | |
wget -qO- 'https://raspi.debian.net/daily/raspi_4.img' | sudo dd "of=$i" bs=1M oflag=dsync status=progress | |
echo "done flashing - $i" >&2 | |
done |
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
# /etc/systemd/system/grafana.service | |
[Unit] | |
Description=grafana | |
Requires=syslog.service | |
After=syslog.service | |
[Service] | |
User=cody | |
Restart=always | |
RestartSec=10 |
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
[Unit] | |
# by: Cody Kochmann | |
# describe the service so journald logs make sense | |
Description=System Logging Service | |
# mandate that systemd ensures syslog socket is created first | |
Requires=syslog.socket systemd-journald.service | |
# note that there is a local manual | |
Documentation=man:rsyslogd(8) | |
# link to official docs online | |
Documentation=https://www.rsyslog.com/doc/ |
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
# for a tcp socket | |
systemd-socket-activate -l 2000 --inetd tee /tmp/test-tcp.log | |
# for a udp socket | |
systemd-socket-activate -l 2000 --inetd -d tee /tmp/test-udp.log |