Skip to content

Instantly share code, notes, and snippets.

View mmkhitaryan's full-sized avatar

Marat Mkhitaryan mmkhitaryan

View GitHub Profile
kubeadm init --config /etc/kubeadm/init.yaml --upload-certs --ignore-preflight-errors=Port-6443
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Marat Mkhitaryan",
"label": "Python Backend Developer",
"location": "Astana, Kazakhstan",
"email": "[email protected]",
"phone": "77082113945",
"profiles": [
{
@mmkhitaryan
mmkhitaryan / README.md
Created September 1, 2024 20:40
AWS ECS stuck in PENDING state g4dn

Disk space issue

In my case I used container which had size of 12GB. It contained yolo model for inference, so the container was large. By default the size of template for ECS ec2 is 30GB, so it could not conain entire OS+Image.

The solution was changing the template root storage to 100GB.

Card type issue

Another case of PROVISIONING stuck was with spot instances. I wanted to save on inference costs, so wanted to run spot instead of on-Demand.

I set the filter to GPU accelerator, and selected all the instances which had GPU. The issue was that there are also non-ndidia GPUs in AWS. So Nvidia driver linux got installed on AMD machines, and the tasks got stuck in PROVISIONING state.

import datetime
from tortoise import Tortoise, fields, timezone
from tortoise.models import Model
NAIVE_DATETIME = datetime.datetime.strptime("2024-2-11","%Y-%m-%d")
class TortoiseModel(Model):
name = fields.CharField(max_length=50, unique=True)
last_register_date = fields.DatetimeField()
@mmkhitaryan
mmkhitaryan / subdomain_finder.js
Created January 6, 2024 17:57
I wanted to find free 2 character netlify subdomain name, but found no :(
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function generateRandomString() {
const randomChar1 = String.fromCharCode(Math.floor(Math.random() * 26) + 65); // Random uppercase letter
const randomChar2 = String.fromCharCode(Math.floor(Math.random() * 26) + 65); // Another random uppercase letter
// Concatenate the two characters
const randomString = randomChar1 + randomChar2;
from collections import defaultdict
pid_to_command_line = {}
list_of_all_processes = []
import csv
field_names = None
import r2pipe
r = r2pipe.open()
r.cmd('ood')
r.cmd('dcu @main')
last_pointer = '1'
while True:
poiner_from_stack = str(r.cmdj('pxqj 8 @rsp')[0])
@mmkhitaryan
mmkhitaryan / run_in_r2.py
Last active September 11, 2022 21:26
Bug in r2pipe?
# r2 /bin/ls
# . ./run_in_r2.py
# 1
# 2
# ... 1000+
import r2pipe
r = r2pipe.open()
# python stack_seeker.py some_file_in_cwd
import r2pipe
import sys
r = r2pipe.open('/bin/ls')
r.cmd('ood')
r.cmd('aaa')
file_name = sys.argv[1]
@mmkhitaryan
mmkhitaryan / hello.c
Created August 30, 2022 10:13
In original article you need to specify the function address manually. I made it detect the function address automatically.
#include <stdio.h>
#include <unistd.h>
void
f (int n)
{
printf ("Number: %d\n", n);
}
int