Skip to content

Instantly share code, notes, and snippets.

@sduff
sduff / rma.py
Created May 17, 2023 09:12
Rolling Moving Average
def r(new_value, old_values):
if len(old_values) > 10:
old_values.pop(0)
old_values.append(new_value)
average = sum(old_values) / len(old_values)
return average, old_values
history = []
for i in range(100):
@sduff
sduff / ccloud-resource-identifiers-after-terraform.txt
Created October 6, 2021 06:29
Accessing Confluent Cloud resource identifiers after running the terraform provider
# Use jq to read the terraform state file
# all id's
jq '.resources[].instances[].attributes.id?' terraform.tfstate
# all display names
jq '.resources[].instances[].attributes.display_name?' terraform.tfstate
# all environment id's
jq '.resources[].instances[].attributes.environment[]?.id'
@bakkujp
bakkujp / Install_Docker_On_Alpine_Linux_3.10.md
Last active May 21, 2022 18:23
How to install Docker on Alpine Linux 3.10
@Firsh
Firsh / lwp-cloudflare-dyndns.sh
Last active January 6, 2024 15:38
Cloudflare as Dynamic DNS
#!/bin/bash
# Cloudflare as Dynamic DNS
# From: https://letswp.io/cloudflare-as-dynamic-dns-raspberry-pi/
# Based on: https://gist.github.com/benkulbertis/fff10759c2391b6618dd/
# Original non-RPi article: https://phillymesh.net/2016/02/23/setting-up-dynamic-dns-for-your-registered-domain-through-cloudflare/
# Update these with real values
auth_email="email@example.com"
auth_key="global_api_key_goes_here"
zone_name="example.com"
@Tras2
Tras2 / cloudflare-ddns-update.sh
Last active April 21, 2024 04:49
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
@nma-io
nma-io / Security_Docker_101.md
Last active August 26, 2020 00:48
A quick guide to deploying some Security Docker Containers.

Install

Grab a copy of Docker for your platform here: https://www.docker.com/community-edition#/download Follow the installation guide and tune the docker system to run with as much memory and CPU as you're willing to feed to it.

Docker Containers I find useful for general security tasks:

Local Debian instance: debian:latest

Metasploit: remnux/metasploit

@marwei
marwei / how_to_reset_kafka_consumer_group_offset.md
Created November 9, 2017 23:39
How to Reset Kafka Consumer Group Offset

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
@a7madgamal
a7madgamal / dark.md
Last active July 14, 2023 04:00
Dark mode for Slack on MacOS
@tomasbasham
tomasbasham / install_tmux_osx_no_brew
Last active April 29, 2024 08:46 — forked from Fi5t/install_tmux_osx_no_brew
Install tmux on OSX WITHOUT brew
# Create a directory
mkdir ~/tmux-install
cd ~/tmux-install
# Get the files
curl -OL https://www.openssl.org/source/openssl-1.0.2l.tar.gz
curl -OL https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz
curl -OL https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
# Extract them
@rcmorano
rcmorano / docker-registry-expect-scripted-login
Created March 29, 2017 09:52
expect script to interact with "docker login"
#!/bin/bash
#DOCKER_REGISTRY_URI=_DOCKER_REGISTRY_URI_
#DOCKER_REGISTRY_USER=_DOCKER_REGISTRY_USER_
#DOCKER_REGISTRY_PASS=_DOCKER_REGISTRY_PASS_
expect <<EOF
spawn docker login -u $DOCKER_REGISTRY_USER $DOCKER_REGISTRY_URI
while (1) {
expect {