Skip to content

Instantly share code, notes, and snippets.

@invictus-ir
invictus-ir / CloudTrail.csv
Last active April 25, 2024 17:23
An overview of CloudTrail events that are interesting from an Incident Response perspective
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 10 columns, instead of 9. in line 7.
"Initial Access","Execution","Persistence","Privilege Escalation","Defense Evasion","Credential Access","Discovery","Lateral Movement","Exfiltration","Impact"
ConsoleLogin,StartInstance,CreateAccessKey,CreateGroup,StopLogging,GetSecretValue,ListUsers,AssumeRole,CreateSnapShot,PutBucketVersioning
PasswordRecoveryRequested,StartInstances,CreateUser,CreateRole,DeleteTrail,GetPasswordData,ListRoles,SwitchRole,ModifySnapshotAttributes ,RunInstances
,Invoke,CreateNetworkAclEntry,UpdateAccessKey,UpdateTrail,RequestCertificate,ListIdentities,,ModifyImageAttribute,DeleteAccountPublicAccessBlock
,SendCommand,CreateRoute,PutGroupPolicy,PutEventSelectors,UpdateAssumeRolePolicy,ListAccessKeys,,SharedSnapshotCopyInitiated,
,,CreateLoginProfile,PutRolePolicy,DeleteFlowLogs,,ListServiceQuotas,,SharedSnapshotVolumeCreated,
,,AuthorizeSecurityGroupEgress,PutUserPolicy,DeleteDetector,,ListInstanceProfiles,,ModifyDBSnapshotAttribute,
,,AuthorizeSecurityGroupIngress,AddRoleToInstanceProfile,DeleteMembers,,ListBuckets,,PutBucketP
@spullara
spullara / chat
Last active March 26, 2024 19:19
Use this command to get suggestions on how to do things on the command line.
#!/bin/bash
TOKEN=< OpenAI token from https://platform.openai.com/account/api-keys >
PROMPT="You are the best at writing shell commands. Assume the OS is Ubuntu. I want you to respond with only the shell commands separated by semicolons and no commentary. Here is what I want to do: $@"
RESULT=`curl -s https://api.openai.com/v1/chat/completions \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $TOKEN" \
-d "{
\"model\": \"gpt-3.5-turbo\",
\"messages\": [{\"role\": \"user\", \"content\": \"$PROMPT\"}]
}" | jq '.choices[] | .message.content' -r`
@mansu
mansu / kafka-server.properties
Created February 4, 2022 23:21
Slack Kafka server config
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@mjf
mjf / PromQL_to_SQL_Idioms_for_Promscale.md
Last active August 23, 2022 19:48
PromQL to SQL Idioms for Promscale

PromQL to SQL Idioms for Promscale

Legend

Variable Meaning
METRIC Metric name (i.e. cpu_usage_system)
NAME Name for the metric value (corresponds to AS "NAME" in SQL)
@brettbuddin
brettbuddin / dump-pod-goroutines.sh
Created April 13, 2020 15:28
Script to dump goroutine stack traces from Pods in Kubernetes.
#!/usr/bin/env zsh
if [ "$#" -ne 2 ]; then
echo "dump-pod-goroutines <labels> <port>"
exit 1
fi
labels="$1"
port="$2"
@StevenACoffman
StevenACoffman / _MicroService Proxy Gateway Solutions.md
Last active September 28, 2023 14:54
Microservice Proxy/Gateway Solutions

MicroService Proxy Gateway Solutions

Kong, Traefik, Caddy, Linkerd, Fabio, Vulcand, and Netflix Zuul seem to be the most common in microservice proxy/gateway solutions. Kubernetes Ingress is often a simple Ngnix, which is difficult to separate the popularity from other things.

Github Star Trend:

Github Star History for Kong vs traefik vs fabio vs caddy vs Zuul

This is just a picture of this link from March 2, 2019

Originally, I had included some other solution

final long writeBufferSize = 8 * 512 * 1024 * 1024L;
final long softPendingCompactionBytesLimit = 100 * 64 * 1073741824L;
options.setAllowConcurrentMemtableWrite(true);
options.setEnableWriteThreadAdaptiveYield(true);
options.setBytesPerSync(1024*1024);
options.setWalBytesPerSync(1024*1024);
options.setMaxBackgroundCompactions(20);
options.setBaseBackgroundCompactions(20);
options.setMaxSubcompactions(8);
@prasanthj
prasanthj / native-mem-tracking.md
Last active March 2, 2024 15:00
Native memory tracking in JVM

Enable native memory tracking in JVM by specifying the following flag

-XX:NativeMemoryTracking=detail

Know the <PID> of the java process

jps

To print ps based RSS

ps -p <PID> -o pcpu,rss,size,vsize

To print native memory tracking summary

# Docker Machine for Consul
docker-machine \
create \
-d virtualbox \
consul-machine
# Start Consul
docker $(docker-machine config consul-machine) run -d --restart=always \
-p "8500:8500" \
-h "consul" \
@vasanthk
vasanthk / System Design.md
Last active April 26, 2024 01:02
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?