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 | |
| from pathlib import Path | |
| import sys | |
| import aiocoap | |
| from aiocoap.optiontypes import StringOption | |
| from scapy.contrib.coap import CoAP | |
| from scapy.layers.inet import UDP | |
| from scapy.utils import PcapReader |
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 | |
| # Inspired by https://stackoverflow.com/a | |
| # Posted by s-m-e | |
| # Retrieved 2025-12-04, License - CC BY-SA 4.0 | |
| # | |
| # Extended by L. Woodtli | |
| import os | |
| import sys | |
| from pathlib import 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 sh | |
| set -u | |
| set -e | |
| to_rev=$1 | |
| from_rev=$2 | |
| revs=$(git rev-list "$to_rev".."$from_rev") |
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
| import requests | |
| from bs4 import BeautifulSoup | |
| if __name__ == '__main__': | |
| req = requests.get("https://www.coursera.org/learn/dsp4?specialization=digital-signal-processing") | |
| bs = BeautifulSoup(req.text) | |
| tags = bs.find_all(lambda tag: tag.name == 'h3' or (tag.has_attr('data-test-id') and tag['data-test-id'] == 'item-view')) | |
| for t in tags: | |
| try: |
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 | |
| # -*- coding: ISO8859-15 -*- | |
| # This might need some adjustments: | |
| # Save file with the correct encoding and | |
| # make sure that the chars to be replaced | |
| # are encoded correctly in this file. | |
| import os | |
| import sys |
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
| // run it like this: | |
| // stap -v -x <PID> system_tap_example.stp | |
| global count; | |
| probe begin { | |
| count = 0; | |
| printf("Staring system tap session for pid=%i\n", target()); | |
| } |
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/python | |
| import subprocess | |
| import re | |
| import gdb | |
| # This is just an example and might not work poperly! | |
| class BreakpointAtMain(gdb.Breakpoint): | |
| def __init__(self): |
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
| # This is just a small example. There are better tools to use when dealing with ELF files. | |
| from hachoir.core.endian import LITTLE_ENDIAN | |
| from hachoir.field import Parser, Bytes, UInt8, Enum, PaddingBytes, FieldSet, UInt16, UInt32 | |
| from hachoir.stream import FileInputStream | |
| class Ident(FieldSet): | |
| endian = LITTLE_ENDIAN | |
| EI_NIDENT = 16 |
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
| from bs4 import BeautifulSoup | |
| with open(r'MyBool Packt.htm') as in_file: | |
| soup = BeautifulSoup(in_file, 'html.parser') | |
| toc = soup.find_all('ol', id="accordion-toc") | |
| entry = soup.find_all('a', class_='toc-index') | |
| for e in entry: | |
| print(e.text.strip()) |
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
| import fileinput | |
| import os | |
| import sys | |
| # WARNING: This is Work-In-Progress!!! | |
| def convert(inp): | |
| code_snippet = False | |
| for line in inp: | |
| if code_snippet and line == "\n": |
NewerOlder