Skip to content

Instantly share code, notes, and snippets.

View tonyprawiro's full-sized avatar
🦉
git push origin master --force

Tony P. Hadimulyono tonyprawiro

🦉
git push origin master --force
View GitHub Profile
@tonyprawiro
tonyprawiro / learning-cloudera.txt
Last active March 15, 2024 08:22
Cloudera URLs
https://docs.cloudera.com/management-console/cloud/user-management/topics/mc-cdp-account-administrator.html
https://docs.cloudera.com/management-console/cloud/user-management/topics/mc-configuring-identity-providers.html
https://docs.cloudera.com/management-console/cloud/user-management/topics/mc-disabling-the-cloudera-sso-login.html
https://docs.cloudera.com/management-console/cloud/user-management/topics/mc-synchronizing-group-membership.html
https://docs.cloudera.com/management-console/cloud/user-management/topics/mc-generating-identity-provider-metadata.html
#!/bin/sh
# Source: http://kubernetes.io/docs/getting-started-guides/kubeadm
set -e
source /etc/lsb-release
if [ "$DISTRIB_RELEASE" != "20.04" ]; then
echo "################################# "
echo "############ WARNING ############ "
#!/bin/sh
# Source: http://kubernetes.io/docs/getting-started-guides/kubeadm
set -e
source /etc/lsb-release
if [ "$DISTRIB_RELEASE" != "20.04" ]; then
echo "################################# "
echo "############ WARNING ############ "
@tonyprawiro
tonyprawiro / gist:f0f34b8face2c923995f81bd288f258c
Created October 7, 2022 23:35
Gatekeeper on minikube for quick learning
# Setup docker for Amazon Linux
sudo yum -y install docker
sudo usermod -a -G docker ec2-user
newgrp docker
sudo systemctl start docker.service
# Setup docker for Ubuntu
# Tested with Vagrant box ubuntu/focal64 version 20221005.0.0
# Vagrantfile:
@tonyprawiro
tonyprawiro / tokenbucket.py
Created May 24, 2020 12:56
Python stuffs
class TokenBucket:
def __init__(self, bucketname, hostname, portnumber):
self.bucketname = bucketname
self.capacity = 1000 # max tokens in bucket
self.windowTimeMin = 10 # how many mins to populate bucket with max tokens
self.refillTokenPerMin = self.capacity / self.windowTimeMin # e.g. cap = 1000 tokens, window = 10 mins, then add 100 tokens/min
self.memcachedClient = Client((hostname, portnumber))
self.tokenBalance = 0 # initial value
def getLastRefill(self):
@tonyprawiro
tonyprawiro / base64fu.md
Created May 24, 2020 08:09
Powershell stuffs

Encode

[Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes("foo"))

Decode

[System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String("bar"))
@tonyprawiro
tonyprawiro / policy.json
Created June 16, 2017 02:40
ECR repository policy
{
"Statement": [
{
"Action": [
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"ecr:BatchCheckLayerAvailability",
"ecr:PutImage",
"ecr:InitiateLayerUpload",
"ecr:UploadLayerPart",
@tonyprawiro
tonyprawiro / ssm.tf
Created June 16, 2017 02:36
SSM association
resource "aws_ssm_association" "myapp_adwriter" {
name = "myapp_dir_default_doc"
instance_id = "${aws_instance.vm_adwriter.id}"
depends_on = ["aws_ssm_document.myapp_dir_default_doc", "aws_instance.vm_adwriter"]
}
@tonyprawiro
tonyprawiro / ssm.tf
Created June 16, 2017 02:35
SSM document
resource "aws_ssm_document" "myapp_dir_default_doc" {
name = "myapp_dir_default_doc"
document_type = "Command"
content = <<DOC
{
"schemaVersion": "1.0",
"description": "Join an instance to a domain",
"runtimeConfig": {
"aws:domainJoin": {
@tonyprawiro
tonyprawiro / iam_roles.tf
Created June 16, 2017 02:34
IAM policy to provide SSM permission
resource "aws_iam_role_policy" "policy_allow_all_ssm" {
name = "IAM_POLICY_ALLOW_ALL_SSM"
role = "${aws_iam_role.iam_role_adwriter.id}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAccessToSSM",
"Effect": "Allow",