Skip to content

Instantly share code, notes, and snippets.

View dimisjim's full-sized avatar
🇨🇭

Dimitris Moraitidis dimisjim

🇨🇭
View GitHub Profile
@atheiman
atheiman / get-accounts-recursive.sh
Last active January 19, 2024 13:21
Get all accounts within an AWS Organizations organizational unit recursively (all accounts nested under any child OUs)
#!/bin/bash
if [ -z "$1" ]; then
echo "Error - Usage: $0 <parent-id>"
exit 1
fi
set -eu
# set -x
@devdattaT
devdattaT / LocationHistory.md
Created February 14, 2019 04:15
How to Visualize your Google Location History

Google is extremely transparent about the Location History it has on you. You can check it out on the timeline feature in the Google Maps application on the phone, or on https://www.google.com/maps/timeline It is possible that you have that turned off, and in that case, consider yourself lucky.

If there is data there, you can view it online, or Download and Analyze it yourself.

@brikis98
brikis98 / main.tf
Last active March 14, 2023 23:43
A hacky way to create a dynamic list of maps in Terraform
# The goal: create a list of maps of subnet mappings so we don't have to statically hard-code them in aws_lb
# https://www.terraform.io/docs/providers/aws/r/lb.html#subnet_mapping
locals {
# These represent dynamic data we fetch from somewhere, such as subnet IDs and EIPs from a VPC module
subnet_ids = ["subnet-1", "subnet-2", "subnet-3"]
eips = ["eip-1", "eip-2", "eip-3"]
}
# Here's the hack! The null_resource has a map called triggers that we can set to arbitrary values.
# We can also use count to create a list of null_resources. By accessing the triggers map inside of
@alexellis
alexellis / k8s-pi.md
Last active April 11, 2024 14:17
K8s on Raspbian
@quiver
quiver / retrieve-EC2-region-information-from-metadata.md
Last active March 14, 2024 16:42
retrieve EC2's region from instance metadata

Sometimes you want to retrieve EC2 insntances' region information.

You can query that information through instance metadata(169.254.169.254).

$ curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document
{
  "privateIp" : "172.31.2.15",
  "instanceId" : "i-12341ee8",
  "billingProducts" : null,
 "instanceType" : "t2.small",
@revolunet
revolunet / backup.py
Last active October 14, 2022 22:12
download your google drive files with python
# -*- encoding: UTF-8 -*-
import os
import httplib2
# pip install --upgrade google-api-python-client
from oauth2client.file import Storage
from apiclient.discovery import build
from oauth2client.client import OAuth2WebServerFlow
@amitchhajer
amitchhajer / Count Code lines
Created January 5, 2013 11:08
Count number of code lines in git repository per user
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n