Skip to content

Instantly share code, notes, and snippets.

@ellieayla
ellieayla / patch-secret-known-hosts.sh
Last active November 17, 2021 03:06
patch-secret-known-hosts.sh
#!/usr/bin/env bash
# Ref https://github.com/fluxcd/source-controller/issues/490
# Ref https://github.blog/2021-09-01-improving-git-protocol-security-github/
function usage() {
echo "Usage: $0 context [list|diff|apply]"
}
if [ -z "$1" ]; then
#!/usr/bin/env python
from __future__ import division
import hashlib
users = ['alice','bob','cathy','david','XARLAX', 'e','f','g','h','i']
users = ['Sophia', 'Emma', 'Olivia', 'Isabella', 'Ava', 'Mia', 'Emily', 'Abigail', 'Madison', 'Elizabeth', 'Charlotte', 'Avery', 'Sofia', 'Chloe', 'Ella', 'Harper', 'Amelia', 'Aubrey', 'Addison', 'Evelyn', 'Natalie', 'Grace', 'Hannah', 'Zoey', 'Victoria', 'Lillian', 'Lily', 'Brooklyn', 'Samantha', 'Layla', 'Zoe', 'Audrey', 'Leah', 'Allison', 'Anna', 'Aaliyah', 'Savannah', 'Gabriella', 'Camila', 'Aria', 'Kaylee', 'Scarlett', 'Hailey', 'Arianna', 'Riley', 'Alexis', 'Nevaeh', 'Sarah', 'Claire', 'Sadie', 'Peyton', 'Aubree', 'Serenity', 'Ariana', 'Genesis', 'Penelope', 'Alyssa', 'Bella', 'Taylor', 'Alexa', 'Kylie', 'Mackenzie', 'Caroline', 'Kennedy', 'Autumn', 'Lucy', 'Ashley', 'Madelyn', 'Violet', 'Stella', 'Brianna', 'Maya', 'Skylar', 'Ellie', 'Julia', 'Sophie', 'Katherine', 'Mila', 'Khloe', 'Paisley', 'Annabelle', 'Alexandra', 'Nora', 'Melanie', 'London', 'Gianna', 'Naom
@ellieayla
ellieayla / pulse.py
Created May 2, 2021 18:08
Pulse Raspberry PI GPIO pin for 1 second
from gpiozero import LED
from time import sleep
# https://gpiozero.readthedocs.io/en/stable/recipes.html
# Pi Model 3B V1.2
output_relay = LED(4)
def pulse(out=output_relay):
out.on()
@ellieayla
ellieayla / deny-ingress.yaml
Created March 19, 2021 15:58
Do I understand NetworkPolicy behavior?
# https://raw.githubusercontent.com/fluxcd/flux2/main/manifests/policies/deny-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-ingress
spec:
policyTypes:
- Ingress
- Egress
@ellieayla
ellieayla / eventhub-send-deadlock.py
Created March 7, 2020 17:53
eventhub-send-deadlock-issue
import logging
import time
import json
from azure.eventhub import EventHubProducerClient, EventData
CONNECTION_STRING='Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=someone;SharedAccessKey=secret'
EVENTHUB_NAME='example'
@ellieayla
ellieayla / namespace-permission-test.yaml
Created May 13, 2019 17:03
A ServiceAccount in a namespace can be given permissions to act in another namespace.
### Can a ServiceAccount in a namespace be given permissions to act in another namespace?
# Answer: Yes. A RoleBinding in one namespace can cite a ServiceAccount in *any* namespace.
### Test
# $ kubectl apply -f namespace-permission-test.yaml
### Manifests
@ellieayla
ellieayla / k-k-issue-73541.md
Last active April 15, 2022 00:58
kubernetes/kubernetes issue 73541
@ellieayla
ellieayla / 1 clone
Created May 25, 2018 19:07
azure-iot-sdk-python issue-105 build-log python-36
reki:tmp alan$ git clone https://github.com/alanjcastonguay/azure-iot-sdk-python.git reproduction-alanjcastonguay-azure-iot-sdk-python.git
Cloning into 'reproduction-alanjcastonguay-azure-iot-sdk-python.git'...
remote: Counting objects: 37657, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 37657 (delta 2), reused 9 (delta 2), pack-reused 37646
Receiving objects: 100% (37657/37657), 39.81 MiB | 1.63 MiB/s, done.
Resolving deltas: 100% (22884/22884), done.
#!/usr/bin/env python
# https://www.reddit.com/r/Python/comments/7v9kse/filesocket_descriptor_share_across_process/
# >>> hi, can we send a file/socket descriptor (with access and permissions) from one process to another ?
# >>> I mean not by forking but when process are already created .
"""
Demonstrate sending an open file descriptor between a pair of processes, the recipient of
which will read the file contents, depite not having permission to open(..., 'r') the file.
"""
@ellieayla
ellieayla / pycharm_community_url.py
Created January 28, 2018 06:34
Direct download url for the latest PyCharm Community Edition.
#!/usr/bin/env python
"""
The JetBrains Toolbox app fetches (xz-compressed) json feeds inside ASN.1 signedData.
Retrieve the feed and locate the direct download url for the latest PyCharm Community Edition.
"""
from __future__ import print_function
import json