Skip to content

Instantly share code, notes, and snippets.

View thecraftman's full-sized avatar
🙂
Available

Ore-Aruwaji Tola thecraftman

🙂
Available
View GitHub Profile
@thecraftman
thecraftman / logstash.conf
Last active May 11, 2021 09:03
Logstash → Axiom Configuration
input{
exec{
command => "date"
interval => "1"
}
}
output{
elasticsearch{
hosts => ["$YOUR_AXIOM_URL:443/api/v1/datasets/<dataset>/elastic"]
# api_key can be your ingest or personal token
@thecraftman
thecraftman / pythongenerator.py
Created May 13, 2021 14:56
Randomly create passwords in Python using the Input variable
# Before running this code, make sure you have Python 3 and above Installed on your machine.
# Run the file using python3 pythongenerator.py
# Creating a password generator in Python
# string library to generate the password
import string
# generate secure and random passwords
import random
@thecraftman
thecraftman / env.yaml
Created May 18, 2021 15:22
Add the environment variable values for your Axiom host, dataset, and the ingest token.
env:
- name: AXIOM_HOST
value: http://cloud.axiom.co // replace with your self-host url if needed
- name: AXIOM_DATASET_NAME
value: aks-logs
- name: AXIOM_INGEST_TOKEN
value: xait-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
@thecraftman
thecraftman / heartbeat.yaml
Created May 26, 2021 19:03
Heartbeat Configuration
# Disable index lifecycle management (ILM)
setup.ilm.enabled: false
heartbeat.monitors:
- type: icmp
schedule: '*/5 * * * * * *'
hosts: ["myhost"]
id: my-icmp-service
name: My ICMP Service
- type: tcp
@thecraftman
thecraftman / table.md
Last active May 30, 2021 03:52
SQL vs NoSQL
SQL NoSQL
When your access patterns aren't defined When your access pattern is defined.
When you want to perform flexible queries. If your access patterns arent define you won't know what queries to perform. When your primary key is known.
When you want to perform relational queries. When your data model fits (graphs)
When you want to enforce field constraints, this allows you to keep your data consistent. High efficiency Scaling
When you want to use a documented access language (SQL) is generally universal across all the Relational Database Engines. When you need high performance and low latency.
Data use Schemes Schema-less
Relations! No (very few) Relations
Data is distributed across multiple tables Data is typically merged and nested in a few collections
@thecraftman
thecraftman / packetbeat-redis.yml
Created June 8, 2021 16:51
Capture the network traffic from Redis layer protocol using Packetbeat
# Disable index lifecycle management (ILM)
setup.ilm.enabled: false
# network device to capture traffic from
packetbeat.interfaces.device: en0
# Configure the maximum size of the packets to capture
packetbeat.interfaces.snaplen: 44937833987
# Configure Sniffing & traffic capturing options
packetbeat.interfaces.type: pcap
# Configure the maximum size of the shared memory buffer to use
packetbeat.interfaces.buffer_size_mb: 400
@thecraftman
thecraftman / list.py
Last active July 4, 2021 21:19
Python Generators - why to use them and the benefits you receive
def square_numbers(nums):
result = []
for i in nums:
result.append(i*i)
return result
my_nums = square_numbers([1,2,3,4,5])
# my_nums = [x * x for x in [1,2,3,4,5]]
@thecraftman
thecraftman / generator.py
Last active July 4, 2021 21:19
Python generator
def square_numbers(nums):
for i in nums:
yield(i*i)
my_nums = square_numbers([1, 2, 3, 4, 5])
print my_nums
@thecraftman
thecraftman / generator1.py
Last active July 4, 2021 21:18
Python Generators
def square_numbers(nums):
for i in nums:
yield(i*i)
my_nums = square_numbers([1, 2, 3, 4, 5])
print next(my_nums)
@thecraftman
thecraftman / generator2.py
Last active July 4, 2021 21:17
Python Generators
def square_numbers(nums):
for i in nums:
yield(i*i)
my_nums = square_numbers([1, 2, 3, 4, 5])
print next(my_nums)
print next(my_nums)
print next(my_nums)
print next(my_nums)