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
const sections = document.getElementsByTagName("section"); | |
let currentSectionIndex = 0 | |
// Add style | |
const style = ` | |
section { | |
padding: 10px 0; | |
height: 100vh; | |
} | |
` |
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
// Reading a password into a finite buffer allows shorter prefixes to match as well. | |
// Live demo at https://cplayground.com/?p=koala-phil-cod | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
int main() { |
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 re | |
import os | |
# Read captured multipart form data that was extracted via Wireshark | |
with open('extracted_multipart.bin', 'rb') as file: | |
multipart = file.read() | |
# Multipart parts are separated by a boundary like | |
# -----------------------------1881080412979790561529271372 |
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
use anyhow::Context; | |
use nix::sys::socket::*; | |
use std::{str, net}; | |
fn main() -> anyhow::Result<()> { | |
log::debug!("Creating socket"); | |
let fd = socket( | |
AddressFamily::Inet, | |
SockType::Datagram, |
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 datetime import datetime, timedelta | |
from typing import List, Tuple | |
from enum import Enum | |
BUCKET_SIZE = 512 | |
PROCESS_EVERY_MS = 30 | |
# Read dump produced by `tcpdump -q`. Lines look like this: |
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
/** | |
* A macro that works like printf, but prints to stderr and includes the file, line number and function name. | |
* From https://bitsector.net/useful-logging-macro/ | |
*/ | |
#define LOG(...) printf("%s:%d %s(): ", __FILE_NAME__, __LINE__, __func__);\ | |
printf(__VA_ARGS__); \ | |
printf("\r\n"); |
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
# Downloads all hrefs from a webpage | |
import os | |
import re | |
import urllib | |
from pathlib import Path | |
from multiprocessing import Pool | |
import httpx |
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 <iostream> | |
#include <cassert> | |
#include <vector> | |
#include <functional> | |
#include <unistd.h> | |
#include <sys/wait.h> | |
#include <cstring> | |
void test_ok() { |
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
// Setup onclick handler for abbr tags. Clicking on an abbr opens an alert box | |
// showing its title/explanation. This is useful on mobile devices that don't | |
// show the title in a tooltip. | |
const abbrs = document.getElementsByTagName("abbr") | |
const titleSpans = document.querySelectorAll("span[title]") | |
for (const abbr of [...abbrs, ...titleSpans]) { | |
abbr.onclick = e => alert(`${e.target.innerText}: ${e.target.title}`) | |
} |
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
# https://www.ionos.com/digitalguide/server/configuration/nextcloud-installation-with-docker/ | |
version: '3' | |
services: | |
db: | |
image: mariadb | |
container_name: nextcloud-mariadb | |
networks: | |
- nextcloud_network | |
volumes: | |
- db:/var/lib/mysql |
NewerOlder