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/sh | |
# This is an example script to force provision a UniFi network device using the controller API | |
# If you are running this externally then replace localhost with the hostname | |
baseurl=https://localhost:8443 | |
# I would make a dedicated admin user for this | |
username=<username_here> | |
password=<password_here> |
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
# This file contains pin mappings for the Creality "v4.2.7" board. To | |
# use this config, during "make menuconfig" select the STM32F103 with | |
# a "28KiB bootloader" and serial (on USART1 PA10/PA9) communication. | |
# If you prefer a direct serial connection, in "make menuconfig" | |
# select "Enable extra low-level configuration options" and select | |
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC | |
# cable used for the LCD module as follows: | |
# 3: Tx, 4: Rx, 9: GND, 10: VCC |
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
#include <string.h> | |
// This function is called when a packet is received on the raw HID interface. | |
// `length` will always be the size of the output (host to device) report in bytes - 32 in current QMK, but will eventually be raised to 64. | |
// Thus, if you wish to send variable length data, you should send the length along with the payload, splitting across multiple reports | |
// if needed, and handle the parsing yourself. | |
// | |
// In this simple example, we check that the first byte of the received data is the ASCII character 'A', | |
// in which case we respond with 'B' and toggle the backlight. | |
void raw_hid_receive(uint8_t *data, uint8_t length) { |
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
from subprocess import Popen, PIPE | |
from time import sleep | |
# run the shell as a subprocess: | |
p = Popen(['python', 'shell.py'], | |
stdin = PIPE, stdout = PIPE, stderr = PIPE, shell = False) | |
# issue command: | |
p.stdin.write('command\n') | |
# let the shell output the result: | |
sleep(0.1) |
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
import os | |
from PIL import Image | |
def extractFrames(inGif, outFolder): | |
frame = Image.open(inGif) | |
nframes = 0 | |
while frame: | |
frame.save( '%s/%s-%s.gif' % (outFolder, os.path.basename(inGif), nframes ) , 'GIF') | |
nframes += 1 |