Skip to content

Instantly share code, notes, and snippets.

View tudormunteanu's full-sized avatar
👨‍💻
Crafting and leading. Mostly Web3 these days. 🛠️🚀 #TechLeader

Tudor Munteanu tudormunteanu

👨‍💻
Crafting and leading. Mostly Web3 these days. 🛠️🚀 #TechLeader
View GitHub Profile
@tudormunteanu
tudormunteanu / commands.sh
Last active August 2, 2024 09:28
Update persistent disk on GCP
# SSH into your vm
gcloud compute ssh --project=<project_id> --zone=<zone> <instance_name>
# for non-boot disk
sudo resize2fs /dev/sdb
# Reference:
https://cloud.google.com/compute/docs/disks/resize-persistent-disk#resize_partitions
@tudormunteanu
tudormunteanu / converting-blockchain-event-logs-hex.md
Last active May 29, 2024 16:26
Converting Ethereum Event log data from hex to integers in Python, JS and BigQuery
@tudormunteanu
tudormunteanu / good-to-great.md
Last active March 25, 2024 17:19
Notes from "Good to Great" by Jim Collins

These are notes from the book "Good to Great" by Jim Collins

They are not sorted in any particular order. I would strongly recommend the whole book to any tech leader, because these notes are highly contextul to myself and the current phase in my journey.

As one of my favorite professors once said, “The best students are those who never quite believe their professors.” True enough. But he also said, “One ought not to reject the data merely because one does not like what the data implies.” I offer everything herein for your thoughtful consideration, not blind acceptance. You’re the judge and jury.

––

To use an analogy, the “Leadership is the answer to everything” perspective is the modern equivalent of the “God is the answer to everything” perspective that held back our scientific understanding of the physical world in the Dark Ages. In the 1500s, people ascribed all events they didn’t understand to God. Why did the crops fail? God did it. Why did we have an earthquake? God d

@tudormunteanu
tudormunteanu / migration.py
Last active August 9, 2023 11:08
Add permissions to all staf members for new models
from django.db import migrations
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
User = get_user_model()
def assign_permissions_to_staff_users(apps, schema_editor):
perms = Permission.objects.filter(content_type__app_label='smart_actions')
staff_users = User.objects.filter(is_staff=True)
@tudormunteanu
tudormunteanu / combinations.ts
Created July 27, 2022 09:58
Combinations of strings up to a certain number of elements
export default function combinations(items: Array<string>, items_length: number, n: number): Array<string> {
const result = [];
const getCombinations = (x, n, m = []) => {
if (n <= 0) {
return m
}
for (var i = 0; i < items_length; i++) {
const value = getCombinations(x, n - 1, [...m, items[i]]);
@tudormunteanu
tudormunteanu / database.tf
Created February 15, 2022 16:30 — forked from smiller171/database.tf
Manage RDS password in Terraform in a sane way
resource "random_password" "db_master_pass" {
length = 40
special = true
min_special = 5
override_special = "!#$%^&*()-_=+[]{}<>:?"
keepers = {
pass_version = 1
}
}
(graphene_mypy)  ~/work/zego/experiments/graphene_mypy/ cat app/api/schema.py
from graphene import Boolean, Field, ObjectType, ResolveInfo
class Query(ObjectType):
healthy = Boolean() <--------------- this is what the Graphene docs deem as recommended
@staticmethod
def resolve_healthy(_: None, __: ResolveInfo) -> bool:
return True

Robot Warehouse

We have installed a robot in our warehouse and now we need to be able to send it commands to control it. We need you to implement the control mechanism.

For convenience the robot moves along a grid in the roof of the warehouse and we have made sure that all of our warehouses are built so that the dimensions of the grid are 10 by 10. We've also made sure that all our warehouses are aligned along north-south and east-west axes.

All of the commands to the robot consist of a single capital letter and different commands are dilineated by whitespace.

Part One

@tudormunteanu
tudormunteanu / timer.py
Created July 16, 2021 15:23
Simple class useful for timing Python code.
class Timer:
"""Measure time used.
# Setup timer
>>> timer = Timer()
# Access as a string
>>> timer.print()
Time elapsed is 0:00:03.
>>> timer.print()
@tudormunteanu
tudormunteanu / ch4.md
Last active April 6, 2021 19:55
Scala For the Impatient 2nd Edition - Excercises
  1. Set up a map of prices for a number of gizmos that you covet. Then produce a second map with the same keys and the prices at a 10 percent discount.

  2. Write a program that reads words from a file. Use a mutable map to count how often each word appears. To read the words, simplyy use a java.utils.Scanner:

val in = new java.util.Scanner(new java.io.File("myFile.txt"))
while (in.hasNext()) *process* in.next()

Or look at Chapter 9 for a Scalesque way.