This file contains hidden or 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 | |
| # Docker API Exec proof of concept. Run a `date` command in a container with curl. | |
| echo "Choose a container ID (or CTRL+C to exit)" | |
| CONTAINER_ID_LIST=$(curl --unix-socket /var/run/docker.sock http://localhost/containers/json 2>/dev/null | jq -r .[].Id) | |
| select CONTAINER_ID in $CONTAINER_ID_LIST; do | |
| # Create an exec instance and retain the ID that was returned. |
This file contains hidden or 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
| #!/usr/bin/env node | |
| /* | |
| * Dynamic HTML from JavaScript without a bunch of `html += ...` madness. | |
| */ | |
| // Define the HTML with {{ }} placeholders for values to be filled in later. | |
| let template = ` | |
| <details> | |
| <summary><img alt="{{state}}" src="icons/{{stateIcon}}">{{name}}</summary> |
This file contains hidden or 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
| #!/usr/bin/env node | |
| import { request } from 'http'; | |
| // Replace containerID below. | |
| const containerID = 'abcdefg1234567890hijklmnop1234567890qrstuv1234567890wxyz12345678'; | |
| function startExec(execID) { | |
| let options = { | |
| socketPath: '/var/run/docker.sock', |
This file contains hidden or 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
| #!/usr/bin/env node | |
| import { request } from 'http'; | |
| function callDockerAPI(path) { | |
| return new Promise ((resolve, reject) => { | |
| let options = { | |
| socketPath: '/var/run/docker.sock', | |
| method: 'GET', | |
| path: path |
This file contains hidden or 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
| #!/usr/bin/env node | |
| /** | |
| * Example of LDAP user authentication using ldapjs. | |
| * | |
| * Run like this: | |
| * auth.js ; echo $? | |
| * | |
| * A successful authentication will show output like this along with a return code of 0: | |
| * Connecting to: [ 'ldap://127.0.0.1:389' ] |
This file contains hidden or 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
| --- | |
| - name: Configure mailboxes for users | |
| hosts: localhost | |
| connection: local | |
| become: true | |
| vars: | |
| accounts: | |
| - pi |
This file contains hidden or 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
| # LED chase that pulses to the beat of the music and features a color changing background. | |
| import machine, neopixel | |
| from time import ticks_ms, sleep_ms | |
| bpm = 128 # Tempo of your mix in beats per minute | |
| num_leds = 42 # Number of NeoPixel LEDs in the strip | |
| data_pin = 16 # Data pin for the NeoPixel strip | |
| bg_colors = [ # Series of changing background colors | |
| (16, 0, 0), # red |
This file contains hidden or 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
| # A short sequence of LED flashes that doubles in frequency with each repetition, ending with a strobe. | |
| import machine, neopixel | |
| from time import ticks_ms, sleep_ms | |
| bpm = 134 # Tempo of your mix in beats per minute | |
| num_leds = 42 # Number of NeoPixel LEDs in the strip | |
| data_pin = 16 # Data pin for the NeoPixel strip | |
| np = neopixel.NeoPixel(machine.Pin(data_pin), num_leds) |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| import sys | |
| import libvirt | |
| conn = None | |
| try: | |
| conn = libvirt.open("qemu:///system") | |
| except libvirt.libvirtError as e: | |
| print(repr(e), file=sys.stderr) | |
| exit(1) |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # Define a storage pool using the libvirt API. | |
| # virsh pool-destroy ; virsh pool-undefine can be used to remove. | |
| import libvirt | |
| import sys | |
| import uuid | |
| import os |
OlderNewer