Skip to content

Instantly share code, notes, and snippets.

View olkitu's full-sized avatar

Minh Truong olkitu

View GitHub Profile
@olkitu
olkitu / README.md
Last active May 15, 2025 10:42
AWS CloudTrails convert to CSV

Download cloudtrail logs from S3 bucket to current working directory

aws s3 sync s3://<s3_bucket> .

Extract compressed cloudtrail log files

find . -type f -exec gunzip {} \;
@olkitu
olkitu / Lenovo ThinkPad X1 Carbon Gen 13 & Ubuntu 24.10.md
Last active January 14, 2025 07:08
My thoughts about with Carbon X1 Gen 13 and Ubuntu 24.10.

ThinkPad X1 Carbon Gen 13 is new laptop with Lunar Lake based CPU. Currently running latest Ubuntu 24.10 with Linux kernel 6.11.

  • Internal Sound Card do not work even Ubuntu detects it
  • Hibernate do not work
  • Some strange lagging during login in
  • Sometimes bluetooth crash
  • Intel WIFI 6 GHz still do not work in Finland where I am based.
@olkitu
olkitu / disable-aws-root.py
Last active December 12, 2024 12:46
Disable AWS root account from managed AWS accounts if MFA not enabled
# Requires boto3 1.35 or newer
# Run this on Organization management account or delegated Administrator account
import boto3
import botocore
import os
os.environ["AWS_STS_REGIONAL_ENDPOINTS"] = "regional"
client_organization = boto3.client('organizations')
client_sts = boto3.client('sts')
@olkitu
olkitu / remove-states.sh
Created October 18, 2024 12:58
Terraform remove all states
#!/bin/bash
set -e
STATE_LIST=$(terraform state list)
IFS=$'\n'
for state in $STATE_LIST;
do
# Skip if use data import
if [[ "$state" == *"data"* ]]; then
@olkitu
olkitu / cloudflare-firewall-examples.md
Last active May 24, 2025 07:28
CloudFlare firewall examples

Some example rules for CloudFlare firewall: https://developers.cloudflare.com/firewall/cf-firewall-rules/fields-and-expressions

Block access to Wordpress php-files

(http.request.uri.path contains "/wp-content/" and http.request.uri.path contains ".php") or (http.request.uri.path contains "/wp-includes/" and http.request.uri.path contains ".php") or (http.request.uri.path eq "/xmlrpc.php") or (http.request.uri.path contains "wp-config")

Block access to sensitive PHP-files

@olkitu
olkitu / docker-clean.sh
Last active April 15, 2021 17:59
Gitlab CI Docker Prune
#!/bin/bash
# Run this daily to cleanup unused images and networks
# chmod +x /etc/cron.daily/docker-clean.sh
# Create new log file
touch /var/log/docker-clean.log
# Delete all unused images and volumes
/usr/bin/docker system prune --volumes -a -f >> /var/log/docker-clean.log
@olkitu
olkitu / Enable5G_Samsung_Qualcomm.md
Last active July 4, 2024 19:11
Enable 5G on Samsung Qualcomm Devices

This is tested Samsung Qualcomm phones S20/S21/Note20 Hong Kong and Taiwan versions.

  1. Prerequisities: You need to download and install Google Phone app from Google Play market (Phone by Google-Caller ID & Spam Protection)

  2. Dialer app by default: After the first launch, the application will ask you to make it the default dialer, confirm by selecting its blue icon from the list of available ones. You can return the native dialer after service menu manipulations (Settings - Apps - 3 dots in the upper right corner - Default apps - Phone)

  3. Activation of the service menu: Go to the Google Phone and dial *#*#27663368378#*#* for Android 10 or *#*#276633683782#*#* for Android 11. After pressing the last asterisk, the service menu will appear.

@olkitu
olkitu / OnePlus8_5G_Support.md
Last active May 30, 2021 08:03
OnePlus 8 and 8 Pro 5G-support 11.0.5.5

List of networks where 5G is enabled by default

Data is taken from OnePlus 8 11.0.5.5 Carrier Policy files. All OnePlus Unlocked models share same modem configurations but hardware supported combinations are different.

Check in cacombos.com site supported combinations:

8-model:

@olkitu
olkitu / OnePlus9_5G_Support.md
Last active December 9, 2021 18:50
OnePlus 9 and 9 Pro 5G-support 11.2.1.1.LE25 / 11.2.1.1.LE15
@olkitu
olkitu / docker-compose.yml
Last active March 20, 2021 16:50
DigitalOcean Metrics Agent on Docker Swarm (Tested RancherOS)
# docker stack deploy docker-compose.yml
version: "3.8"
services:
do-agent:
image: digitalocean/do-agent:stable
deploy:
mode: global
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro