Skip to content

Instantly share code, notes, and snippets.

@tomkins
tomkins / search.py
Created January 11, 2022 10:47 — forked from kaedroho/search.py
from wagtail.wagtailsearch.backends import get_search_backend
from wagtail.wagtailsearch.backends.elasticsearch import ElasticSearchResults
from wagtail.wagtailcore.models import Page
s = get_search_backend()
class AwesomeQuery(object):
def __init__(self, search_query, campaigns, languages,
@tomkins
tomkins / aws_connection.py
Created August 24, 2021 18:05 — forked from michaelfedell/aws_connection.py
Custom Connection Class for elasticsearch-py clien to refresh IAM authentication as needed
import typing
from elasticsearch import RequestsHttpConnection
from elasticsearch.exceptions import ImproperlyConfigured
try:
from requests_aws4auth import AWS4Auth
import boto3
from botocore.credentials import RefreshableCredentials, Credentials
AWS_RESOURCES_MISSING = False
except ImportError:
@tomkins
tomkins / master.sh
Created June 30, 2019 22:07
Python IPv6 Neighbor Advertisements
#!/bin/bash
# all-routers ff02::2
# server1 fe80::f03c:91ff:1122:3344
# server2 fe80::f03c:91ff:5566:7788
exec /usr/local/sbin/pyv6na.py \
2001:db8::1 \
2001:db8::2 \
--interface enp0s3 \

Keybase proof

I hereby claim:

  • I am tomkins on github.
  • I am tomkins (https://keybase.io/tomkins) on keybase.
  • I have a public key ASCFK1Ui3Wa8vEjIkqx10qmjg14RRIdBpg0fHA8UjWtXxwo

To claim this, I am signing this object:

@tomkins
tomkins / cloud-config.yml
Last active February 18, 2024 19:59
Legions cloud-config.yml
#cloud-config
users:
- default
- name: legions
system: true
homedir: /opt/legions
shell: /usr/sbin/nologin
write_files: