Skip to content

Instantly share code, notes, and snippets.

View mike11339's full-sized avatar

Mike L mike11339

View GitHub Profile
@mike11339
mike11339 / HP-Vertica-Date-Time.sql
Created August 21, 2018 16:04 — forked from jackghm/HP-Vertica-Date-Time.sql
Working with HP-Vertica date and time
/*
#1 always write datetime values into the database as UTC!!!
-- Reread that last statement
Vertica will store all datetime values as UTC values
*/
-- I highly recommend storing an Integer column of the Day Date
select TO_CHAR(<% DATA_END_TIME %>::DATE - INTEGER '1', 'YYYYMMDD')::INTEGER AS date_id
SELECT CLOCK_TIMESTAMP() "Current Time"; -- return current time
SELECT NOW(); -- time since last session connection (or commit;) which may be an older time than now
print(Kid.__mro__)
# (<class '__main__.Kid'>, <class '__main__.Dad'>, <class '__main__.Mum'>, <class 'object'>)
kid = Kid()
print(kid.eye_color)
# blue
print(kid.city)
# Amsterdam
kid.swim()
# I can swim
kid.dance()
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:
class Kid(Dad, Mum):
def __init__(self):
Mum.__init__(self)
kid = Kid()
print(kid.eye_color)
# brown
from confluent_kafka import Consumer, TopicPartition
size = 1000000
consumer = Consumer(
{
'bootstrap.servers': 'localhost:9092',
'group.id': 'mygroup',
'auto.offset.reset': 'earliest',
}
)
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)
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")
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)
@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: