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
--- /usr/bin/ssh-copy-id 2020-10-02 18:28:13.000000000 +0200 | |
+++ ./test.sh 2020-10-12 05:34:42.469599079 +0200 | |
@@ -247,7 +247,7 @@ | |
# the -z `tail ...` checks for a trailing newline. The echo adds one if was missing | |
# the cat adds the keys we're getting via STDIN | |
# and if available restorecon is used to restore the SELinux context | |
- INSTALLKEYS_SH=$(tr '\t\n' ' ' <<-EOF) | |
+ INSTALLKEYS_SH=$(tr '\t\n' ' ' <<-EOF | |
cd; | |
umask 077; |
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 ctypes | |
lib = ctypes.CDLL('libblkid.so') | |
lib.blkid_new_probe_from_filename.argtypes = (ctypes.c_char_p,) | |
lib.blkid_new_probe_from_filename.restype = ctypes.c_void_p | |
lib.blkid_free_probe.argtypes = (ctypes.c_void_p,) | |
lib.blkid_do_probe.argtypes = (ctypes.c_void_p,) |
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
#some person on the internet: https://stackoverflow.com/a/9290177 | |
#That is, /etc/mtab should be the convention | |
class MountTableRow: | |
def __init__(self, node, mount_point, fs_type, fs_options, fs_dump, fs_pass): | |
self.node = node | |
self.mount_point = mount_point | |
self.fs_type = fs_type | |
self.fs_options = fs_options | |
self.fs_dump = fs_dump |
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
#/sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT0 | |
#See https://i.imgur.com/yuVyiW7.png for picture of the böp this controls | |
import sys, serial, time | |
min_voltage = 3.5 | |
max_voltage = 3.8 | |
interval = 300 #Every 5 minutes | |
def read_num(filename): | |
with open(filename, 'r') as infile: |
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 subprocess, base64, sys, time, struct, zlib | |
debug = False | |
#added stuff from https://android.googlesource.com/platform/system/bt/+/master/tools/scripts/btsnooz.py | |
def get_snoop(): | |
p = subprocess.Popen(('adb', 'shell', 'dumpsys', 'bluetooth_manager'), stdout=subprocess.PIPE) | |
stdout, stderr = p.communicate() | |
extract = False |
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
AUTO_DELETE = False #Change this to True to delete the socket before usage in case it was never cleaned up for some reason | |
import socketserver, os, struct | |
from socket import * | |
class my_handler(socketserver.StreamRequestHandler): | |
def handle(self): | |
print('New request!', self.request) | |
while True: | |
msg, ancdata, flags, addr = self.request.recvmsg(1024, 1024) |
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 socket import * | |
import struct | |
#Open a file (opens itself now) | |
this_script = open(__file__, 'r') | |
#List of file descriptors to send | |
fd_list = [this_script.fileno()] | |
#Prepare ancillary data |
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
void uart_send_data(volatile void* data, int length) { | |
dma_channel_reset(DMA1, DMA_CHANNEL4); | |
dma_set_peripheral_address(DMA1, DMA_CHANNEL4, (uint32_t) &USART1_DR); | |
dma_set_memory_address(DMA1, DMA_CHANNEL4, (uint32_t) data); | |
dma_set_number_of_data(DMA1, DMA_CHANNEL4, length); | |
dma_set_read_from_memory(DMA1, DMA_CHANNEL4); | |
dma_enable_memory_increment_mode(DMA1, DMA_CHANNEL4); | |
dma_set_peripheral_size(DMA1, DMA_CHANNEL4, DMA_CCR_PSIZE_8BIT); | |
dma_set_memory_size(DMA1, DMA_CHANNEL4, DMA_CCR_MSIZE_8BIT); |
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 ansi_standalone, sys | |
ansi_standalone.install_colored_stdout_retabulator() | |
def F2(): | |
with sys.stdout.indented: | |
print('This is F2') | |
print('We had two lines to say today') |
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 colorsys, sys | |
def bold(text): | |
return f'\x1b[1m{text}\x1b[21m' | |
def italics(text): | |
return f'\x1b[3m{text}\x1b[23m' | |
class color: | |
black = lambda text: f'\x1b[30m{text}\x1b[38m' | |
red = lambda text: f'\x1b[31m{text}\x1b[38m' |