Skip to content

Instantly share code, notes, and snippets.

@avoidik
avoidik / cloud-init-centos.yaml
Last active June 30, 2021 15:20
AWS CodeBuild Agent on Ubuntu EC2
#cloud-config
package_update: true
package_upgrade: true
packages:
- curl
- ruby
runcmd:
@avoidik
avoidik / logstash-cloudwatch.yml
Created June 17, 2021 13:07 — forked from callum-p/logstash-cloudwatch.yml
Deploys lambda functions to forward cloudwatch logs to logstash
Description: Deploys lambda functions to forward cloudwatch logs to logstash
Parameters:
coreNetworkingStackName:
Type: String
Resources:
lambdaRole:
Type: "AWS::IAM::Role"
Properties:
@avoidik
avoidik / log-forwarding-with-etw.ps1
Created June 10, 2021 12:24 — forked from ajpc500/log-forwarding-with-etw.ps1
Quick-and-dirty PowerShell script to install Sysmon (SwiftOnSecurity config), SilkService and Winlogbeat, and forward logs to HELK based on IP set in environment variable "HELK_IP" (see Line 233).
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$wc = New-Object System.Net.WebClient
if (!(Test-Path "C:\Tools")) {
New-Item -Path "C:\" -Name "Tools" -ItemType "directory"
}
# SYSMON
# Download Sysmon
$SysmonDirectory = "C:\Tools\Sysmon\"
@avoidik
avoidik / README.md
Last active October 26, 2024 22:31
Generate user certificate for K8s authentication

Using Kubernetes approval workflow

Generate private key

openssl genrsa -out DevDan.key 2048

Generate csr

@avoidik
avoidik / README.md
Last active August 20, 2022 07:10
Kubernetes Demo Applications
@avoidik
avoidik / aws-auth-cm.sh
Created May 22, 2021 17:31 — forked from pmatv/aws-auth-cm.sh
Map IAM group to EKS ConfigMap
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
IAM_GROUP=${1:-admins}
EKS_ROLE_ARN=${2:-arn:aws:iam::111122223333:role/eks-node-role}
RBAC_GROUP=${3:-system:masters}
@avoidik
avoidik / curl.sh
Last active August 10, 2024 17:12
Use curl instead of kubectl
#!/bin/bash
#
# download yq
#
curl -fsSL https://github.com/mikefarah/yq/releases/download/v4.43.1/yq_linux_amd64 -o /usr/local/bin/yq
chmod +x /usr/local/bin/yq
#
@avoidik
avoidik / install-containerd.sh
Created May 16, 2021 13:29
How to use containerd with conf_template option
DASEL_VER="1.15.0"
CRI_VER="1.5.1"
#
# install dasel
#
curl -fsSL "https://github.com/TomWright/dasel/releases/download/v${DASEL_VER}/dasel_linux_amd64" -o /usr/local/bin/dasel
chmod +x /usr/local/bin/dasel
@avoidik
avoidik / 01_schedule_automl_job.py
Last active May 15, 2021 11:59
AWS SageMaker hands-on - Taken from Data science on AWS book
import boto3
import sagemaker
from time import gmtime, strftime, sleep
#
# be careful, this might be very expensive operation!
#
session = sagemaker.Session(default_bucket='my-demo-amazon-reviews-bucket')
bucket = session.default_bucket()
@avoidik
avoidik / tsv2csv.sh
Last active May 15, 2021 12:06
Convert amazon-reviews-pds from TSV to CSV
pip install -U awscli pandas
aws s3 cp s3://amazon-reviews-pds/tsv/amazon_reviews_us_Automotive_v1_00.tsv.gz .
cat << 'EOF' | python
import pandas as pd
fields = ['star_rating', 'review_body', 'review_id']
dfs = pd.read_csv('amazon_reviews_us_Automotive_v1_00.tsv.gz', sep='\t', usecols=fields, compression='gzip', chunksize=100)
for df in dfs:
df.to_csv('amazon_reviews_us_Automotive_v1_00.csv', index=None, header=True, mode='a')