Skip to content

Instantly share code, notes, and snippets.

View upodroid's full-sized avatar
🤔
Focusing

Mahamed Ali upodroid

🤔
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am upodroid on github.
  • I am upodroid (https://keybase.io/upodroid) on keybase.
  • I have a public key whose fingerprint is FFC3 0291 F3DE A9C4 7F68 8BAF 66FC 50F6 5A1A A35B

To claim this, I am signing this object:

@upodroid
upodroid / snippets.md
Last active February 12, 2020 12:28
Useful gcloud snippets

Useful snippets

gcloud / kubernetes

$(gcloud info --format='value(config.project)') Quick way to get project vars

logs in cli gcloud logging read "SOME FILTER" --project SOME-PROJECT --format json | jq 'reverse[] | .textPayload ' --raw-output -j

Give yourself cluster admin role

@upodroid
upodroid / ansible.log
Last active April 19, 2019 19:03
Ansible broken
upo@helper-instance:~/ops-infra/packer$ packer build ansible.json
googlecompute output will be in this color.
==> googlecompute: Checking image does not exist...
==> googlecompute: Creating temporary SSH key for instance...
==> googlecompute: Using image: ubuntu-1804-bionic-v20190404
==> googlecompute: Creating instance...
googlecompute: Loading zone: europe-west2-b
googlecompute: Loading machine type: n1-standard-1
googlecompute: Requesting instance creation...
@upodroid
upodroid / list.md
Created September 23, 2019 11:02
Kubernetes Todo

Kubernetes Todo

Applications

Ingresses

  • nginx
  • Kong
  • Traefik

Monitoring

@upodroid
upodroid / Linux.md
Created November 7, 2019 22:50
Toolbox

Useful programs on linux

  • fzf
  • kubens
  • kubectx
  • tfenv
  • nvm

Standard tools like

  • kubectl
@upodroid
upodroid / adc.py
Last active April 10, 2021 00:52
Google Service Account Impersonation
import googleapiclient.errors
import requests
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
def GetCredentials(client_id, client_secret, refresh_token):
"""Convert ADC to access_token/Credential"""
params = {
"grant_type": "refresh_token",
"client_id": client_id,
@upodroid
upodroid / image.log
Created August 17, 2020 10:27
Machine Image Errors
REDACTED  MCW0CDP3YY  ~  go  …  github.com  hashicorp  terraform-provider-google-beta   master  26⬇  10✎  6+  $  make testacc TEST=./google-beta TESTARGS='-run=TestAccComputeInstanceFromMachineImage'
==> Checking source code against gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google-beta -v -run=TestAccComputeInstanceFromMachineImage -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc"
=== RUN TestAccComputeInstanceFromMachineImage_basic
=== PAUSE TestAccComputeInstanceFromMachineImage_basic
=== RUN TestAccComputeInstanceFromMachineImage_overrideBootDisk
=== PAUSE TestAccComputeInstanceFromMachineImage_overrideBootDisk
=== RUN TestAccComputeInstanceFromMachineImage_overrideAttachedDisk
=== PAUSE TestAccComputeInstanceFromMachineImage_overrideAttachedDisk
@upodroid
upodroid / debug.log
Created February 24, 2021 18:19
GCS No-current object deletion
==> Checking source code against gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google-beta -v -run TestAccStorageBucket_forceDestroyWithVersioning -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/v3/version.ProviderVersion=acc"
=== RUN TestAccStorageBucket_forceDestroyWithVersioning
=== PAUSE TestAccStorageBucket_forceDestroyWithVersioning
=== CONT TestAccStorageBucket_forceDestroyWithVersioning
2021/02/24 18:10:16 [INFO] Authenticating using DefaultClient...
2021/02/24 18:10:16 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloud-identity https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email]
2021/02/24 18:10:22 [INFO] Authenticating using DefaultClient...
2021/02/24 18:10:22 [INFO] -- Scopes: [https://www.google
@upodroid
upodroid / sg-check.py
Last active May 7, 2021 15:32
AWS Security Group Cleanup
import boto3
import os
def getLambdaSgs():
lambdaclient = boto3.client('lambda', region_name=os.getenv("AWS_REGION"))
marker = None
lambdasgs = []
while True:
if marker:
==> Checking source code against gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google-beta -v -run=TestAccContainerNodePool_maxPodsPerNode -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc"
=== RUN TestAccContainerNodePool_maxPodsPerNode
=== PAUSE TestAccContainerNodePool_maxPodsPerNode
=== CONT TestAccContainerNodePool_maxPodsPerNode
2021/06/11 14:18:22 [INFO] Authenticating using DefaultClient...
2021/06/11 14:18:22 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloud-identity https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email]
2021/06/11 14:18:22 [INFO] Authenticating using DefaultClient...
2021/06/11 14:18:22 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.g