Skip to content

Instantly share code, notes, and snippets.

View whoiskai's full-sized avatar

Kai Hong whoiskai

View GitHub Profile
function Transform(obj) {
try {
obj.name = "Orange";
obj.price = obj.price/0;
} catch (e) {
// ...
}
}
function Transform(obj) {
let item = DeepCopy(obj)
try {
item.name = "Orange";
item.price = obj.price/0;
return item;
} catch (e) {
// ...
}
}
// Some global variable x
let x = 1
// Module A running concurrently
x += 1
print(x) // <- what is x here?
// Module B running concurrently
x += 2
print(x) // <- what is x here?
// Some global variable x
const x = 1
// Module A running concurrently
const foo = x + 1
print(x) // <- what is x here?
print(foo) // <- what is foo here?
// Module B running concurrently
const bar = x + 2
public final class Box {
private final ArrayList<String> fruits;
public Box(ArrayList<String> fruits) {
this.fruits = fruits.clone();
}
public Box addFruit(String fruit) {
final newBox = new Box(this.fruits.clone());
newBox.fruits.add(fruit);
version: "3"
services:
sftpgo:
image: "drakkan/sftpgo:v2-alpine"
# default user id
user: 1026
restart: always
expose:
# HTTP
- "8080"
@whoiskai
whoiskai / DevOps Sharing 04-2022 IAM.md
Last active May 4, 2022 02:21
Extra information from devops sharing on scaling IAM management

User Management

These are the modules related to the sharing. If you're just looking for the modules required to refactor your team's users, you can start from here.

Something that was alluded in the sharing is that policies should always be applied to group instead of users itself. Users itself shouldn't have any policy applied, so all the pre-made policies are on the group level; this includes the permission to assume your base role, as well as forcing MFA, and allowing your users to rotate their own access keys.

The order of creation should be.

@whoiskai
whoiskai / main.tf
Created June 13, 2022 09:14
appconfig module
resource "aws_appconfig_application" "main" {
name = var.application_name
description = var.description
tags = var.tags
}
resource "aws_appconfig_environment" "main" {
name = var.environment_name
description = var.environment_description