Skip to content

Instantly share code, notes, and snippets.

@lcharles123
lcharles123 / README.md
Created November 14, 2024 15:00 — forked from thoroc/README.md
Dockerizing all the things: Running Ansible inside Docker container

Automating things in software development is more than useful and using Ansible is one way to automate software provisioning, configuration management, and application deployment. Normally you would install Ansible to your control node just like any other application but an alternate strategy is to deploy Ansible inside a standalone Docker image. But why would you do that? This approach has benefits to i.a. operational processes.

Although Ansible does not require installation of any agents within managed nodes, the environment where Ansible is installed is not so simple to setup. In control node it requires specific Python libraries and their system dependencies. So instead of using package manager to install Ansible and it’s dependencies we just pull a Docker image.

By creating an Ansible Docker image you get the Ansible version you want and isolate all of the required dependencies from the host machine which potentially might break things in other area

How To Run Yggdrasil In Docker

Want to run Yggdrasil in a Docker container? This is how you can do it.

The keys to getting it working are the following:

  • Give the container access to the TUN interface of the host (or the VM guest in the case of Docker Machine or Docker for Mac)
  • Enable IPv6
  • Assign a dedicated MAC address
@lcharles123
lcharles123 / tcpdump IPv6 router advertisement
Created June 18, 2024 16:36 — forked from hgn/tcpdump IPv6 router advertisement
Capture of IPv6 advertisement message via tcpdump
@virgo:~ $ sudo tcpdump -vvvv -ttt -i eth1 icmp6 and 'ip6[40] = 134'
00:00:00.000000 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 200) fe80::b675:eff:fefa:1cb > ip6-allnodes: [icmp6 sum ok] ICMP6, router advertisement, length 200
hop limit 0, Flags [managed, other stateful], pref medium, router lifetime 1800s, reachable time 0s, retrans time 0s
source link-address option (1), length 8 (1): b4:75:0e:fa:01:cb
0x0000: b475 0efa 01cb
mtu option (5), length 8 (1): 1280
0x0000: 0000 0000 0500
prefix info option (3), length 32 (4): 2a01:ffff:43f::/64, Flags [onlink, auto], valid time 7200s, pref. time 1800s
0x0000: 40c0 0000 1c20 0000 0708 0000 0000 2a01
0x0010: ffff 043f 0000 0000 0000 0000 0000
@lcharles123
lcharles123 / bt-pan.py
Last active May 30, 2024 17:07
Connect to AndroidAP hotspot over bluetooth creating a PAN
#!/usr/bin/env python3
# Ported from a python2 implementation
# To connect a device (like a raspberry pi) to
# android bluetooth internet connection profile,
# first pair/trust the device using bluetoothctl
# after that just call "./bt-pan client -r <mac_addr>"
# "ifconfig bnep0" shows the interface connected
# "dhclient bnep0" to get an IP address
@lcharles123
lcharles123 / Makefile
Last active November 10, 2023 04:14
Install dafny lang binaries and run inside a terminal, no vscode or emacs needed.
#
# Use Dafny lang in any system: setup agnostic
# Tested on Ubuntu 18.04
# install java
# apt install default-jre
#
# install dotnet 6.0 from Microsoft site
# https://dotnet.microsoft.com/en-us/download/dotnet/6.0
#
# install these programs from source:
@lcharles123
lcharles123 / ftx.py
Last active May 16, 2022 18:23
simple ftx client python, provides basic iIterations with FTX.com crypto exchange
#!/usr/bin/rlwrap python3
#-*- coding:utf-8 -*-
# apt install rlwrap, add console history support
"""Since FTX site uses a lot of CPU with markets with high activity
You can use this simple script to iteract.
Order cancelation is better using the site https://ftx.com/orders
"""
import time
import hmac
from requests import Request, Session
@lcharles123
lcharles123 / ic.py
Last active May 4, 2022 16:25
Compute index of coincidence, python
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
"""
IC = sum i=1 to c(n_i * (n_i-1)) / N(N-1)/c
c = len(alphabet)
N = len(text)
"""
from collections import Counter
from functools import reduce
@lcharles123
lcharles123 / README.md
Created June 1, 2020 19:14 — forked from maxious/README.md
Esee/Anran 960P 180° Wireless Fisheye Panoramic CCTV Smart Camera HD WIFI Webcam IP
@lcharles123
lcharles123 / bwtest.sh
Created January 25, 2020 00:44 — forked from hackerb9/bwtest.sh
Busybox compatible simple speedtest that downloads a file to /dev/null. Useful for sshing into various routers and seeing where the bottleneck is.
#!/bin/sh
# Silly speed test just by downloading a file directly to /dev/null
# Useful on routers which only have busybox installed.
# B9 2016, 2018
dotest() {
# $1 is which file to grab 100, 10, or 1 (megabytes).
megabytes=$1