Skip to content

Instantly share code, notes, and snippets.

View mike11339's full-sized avatar

Mike L mike11339

View GitHub Profile
@mike11339
mike11339 / jq-cheetsheet.md
Created October 2, 2022 00:39 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@mike11339
mike11339 / list-of-curl-options.txt
Created January 30, 2022 20:30 — forked from eneko/list-of-curl-options.txt
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@mike11339
mike11339 / cert_commands.md
Created August 9, 2021 21:12 — forked from alopresto/cert_commands.md
Commonly used certificate and keystore commands for verifying Apache NiFi API/UI TLS MA connections.

Certificate and key commands

1. Verify connection:

$ openssl s_client -connect <host:port> -debug -state -cert <path_to_your_cert.pem> -key <path_to_your_key.pem> -CAfile <path_to_your_CA_cert.pem>

2. Export client cert from PKCS12 keystore to PEM:

class Teacher(Job):
def __init__(self, person_name, school):
super().__init__(person_name)
self.school = school
def task(self):
print("working")
teacher = Teacher2("xiaoxu", "TU delft")
print(teacher.school)
class Job:
def __init__(self, person_name):
self.name = person_name
def task(self):
print("working")
class Teacher(Job):
def task(self):
print("teach students")
class Job:
def __init__(self, person_name):
self.name = person_name
def task(self):
print("working")
class Teacher(Job):
def task(self):
print("teach students")
from confluent_kafka import Producer
from python_kafka import Timer
producer = Producer({'bootstrap.servers': 'localhost:9092'})
msg = ('kafkatest' * 20).encode()[:100]
size = 1000000
def delivery_report(err, decoded_message, original_message):
if err is not None:
print(err)
from confluent_kafka import Consumer, TopicPartition
size = 1000000
consumer = Consumer(
{
'bootstrap.servers': 'localhost:9092',
'group.id': 'mygroup',
'auto.offset.reset': 'earliest',
}
)
class Kid(Dad, Mum):
def __init__(self):
Mum.__init__(self)
kid = Kid()
print(kid.eye_color)
# brown
class Dad:
def __init__(self):
self.eye_color = "blue"
self.hair_color = "black"
self.city = "Amsterdam"
def swim(self):
print("I can swim")
class Mum: