Skip to content

Instantly share code, notes, and snippets.

@kriskbx
kriskbx / fix-missmatched-macvlan-ips.js
Created October 29, 2024 11:35
Static ip-addresses for Docker Swarm services
/*
* This is a node.js script supposed to run regularly on a docker swarm node and allows
* containers in a macvlan (or ipvlan) network to have static ip addresses. This is currently
* not possible using Docker Swarm. It doesn't use any external dependencies and instead
* calls docker cli commands directly. So, if you want to run it in a container, make
* sure to bind the docker socket into the container as well.
*
* It works by reading a `macvlan-static-ip` label from the service, e.g. 192.168.0.80
* (This is the desired ip address for the resulting container). And then it "starts"
* and "stops" containers in the right order to ensure they get their configured ip.
@kriskbx
kriskbx / guestbook.md
Last active November 16, 2022 14:16
Guestbook

Hello Internet!

@kriskbx
kriskbx / ruby_pos58_tweetprinter.rb
Last active March 24, 2019 11:24
Ruby POS58 Tweetprinter
#!/usr/bin/env ruby
# -*- encoding : utf-8 -*-
# A simple script to search for tweets that contain certain hashtags and print them on a POS58 printer.
# Make sure the printer is connected and you can print by writing to /dev/usb/lp0 (or similar)
#
# Run `ruby ruby_pos58_tweetprinter.rb` for using the streaming API: instant printing.
# Run `ruby ruby_pos58_tweetprinter.rb get` for using the good old REST API. You can put this in a cronjob.
#
# Copyright (c) 2015 http://github.com/kriskbx