Use this file to geocode IPs from logfiles and draw them on a map.
This script requires geocoder to be installed, so setup a virtualenv:
$ virtualenv --python=python3 venv| #!/usr/bin/env python3 | |
| import threading | |
| import socket | |
| class Relay(threading.Thread): | |
| def __init__(self, stop_listening, socket_a, socket_b, direction_indicator): | |
| super().__init__() | |
| self._stop_listening = stop_listening | |
| self._socket_a = socket_a | |
| self._socket_b = socket_b |
| #!/usr/bin/env python3 | |
| from PIL import Image | |
| def diff(image_a, image_b): | |
| pixels_a = image_a.load() | |
| pixels_b = image_b.load() | |
| width_a, height_a = image_a.size | |
| width_b, height_b = image_b.size |
| import { useState } from "react"; | |
| export const useDragAndDrop = <T extends HTMLElement>() => { | |
| const [isDragging, setIsDragging] = useState(false); | |
| const [innerOffsetX, setInnerOffsetX] = useState(0); | |
| const [innerOffsetY, setInnerOffsetY] = useState(0); | |
| const start = (event: React.MouseEvent<T, MouseEvent>) => { | |
| const element = event.target as T; | |
| const { left, top } = element.getBoundingClientRect(); |
| #!/usr/bin/python2 | |
| def set_speed(pwm, speed): | |
| speed = max(0, min(100, speed)) | |
| speed = 2.55 * speed | |
| speed = int(speed) | |
| with open("/sys/class/hwmon/hwmon1/pwm" + str(pwm), "w") as f: | |
| f.write(str(speed)) |
| #!/usr/bin/env python3 | |
| import urllib.request | |
| import os | |
| import re | |
| import sys | |
| from concurrent.futures import ProcessPoolExecutor as PoolExecutor, as_completed | |
| from PIL import Image | |
| image_page_link_pattern = re.compile(r"src=\"https:\/\/thumbs\.dreamstime\.com\/t\/([^\"]+)") |
| #!/usr/bin/env python2 | |
| import sys | |
| import os | |
| def call_acpi(command): | |
| with open('/proc/acpi/call', 'w') as acpi_call: | |
| acpi_call.write(command) | |
| # Response |
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Untitled</title> | |
| <style type="text/css"> | |
| @keyframes fade-white { | |
| 0% { | |
| background-color: #1e1e1e; | |
| } |