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 json | |
import math | |
import requests | |
from pyproj import Transformer | |
def __create_rough_circle_polygon(center, diameter=10, num_vertices=60): | |
""" | |
Create a rough circular polygon with a given diameter centered at the given coordinate. |
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
<script lang="ts"> | |
import { WidgetInstance } from "friendly-challenge" | |
import { createEventDispatcher, onDestroy, onMount } from "svelte" | |
const dispatch = createEventDispatcher<{ solve: string }>() | |
export let sitekey: string | |
let widgetDiv: HTMLDivElement | |
let widget: WidgetInstance |
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 django.core.management.base import BaseCommand | |
from wagtail.core.models import Page | |
SF_CLASS_NAMES = [ | |
"StreamField", | |
"TranslationStreamField", | |
"TranslationNoWrapsStreamField", | |
"NoWrapsStreamField", | |
] |
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
user www-data; | |
worker_processes auto; | |
pid /run/nginx.pid; | |
worker_rlimit_nofile 65535; | |
events { worker_connections 65535; } | |
http { | |
sendfile on; | |
tcp_nopush on; |
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 time | |
from io import BytesIO | |
from threading import Thread | |
import requests | |
from sanic import Sanic, response | |
from sanic.request import Request | |
global_stream_dict = {} |
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/sbin/nft -f | |
# vim: ft=pf | |
# {{ interface }} would be `eth0` or `enp3s0` or similar | |
table inet filter { | |
chain forward { | |
iifname docker0 oifname {{ interface }} accept | |
iifname {{ interface }} oifname docker0 ct state established accept | |
iifname {{ interface }} oifname docker0 ct state related accept | |
} | |
} |
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
# see https://codex.wordpress.org/Database_Description | |
from django.db import models | |
class WpUsers(models.Model): | |
id = models.BigAutoField(db_column='ID', primary_key=True) | |
user_login = models.CharField(max_length=60) | |
user_pass = models.CharField(max_length=255) | |
user_nicename = models.CharField(max_length=50) |
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
class PickleThis: | |
def __init__(self, filename, age=86400): | |
self.file = filename | |
self.age = age | |
def __enter__(self): | |
if os.path.isfile(self.file) and (time.time() - os.stat(self.file).st_mtime) < self.age: | |
self.new = False | |
with open(self.file, 'rb') as f: | |
self.content = pickle.load(f) |