Skip to content

Instantly share code, notes, and snippets.

@vicyap
vicyap / any-demo.cpp
Last active November 5, 2016 09:40
C++17 any demo
#include <experimental/any>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using namespace std::experimental;
@vicyap
vicyap / tech-interview-guide.md
Last active February 9, 2021 06:22
tech interview guide

A quick guide on getting ready for tech interviews.

Chitchat like a pro.

Before diving into code, most interviewers like to chitchat about your background. They're looking for:

  • Metacognition about coding. Do you think about how to code well?
  • Ownership/leadership. Do you see your work through to completion? Do you fix things that aren't quite right, even if you don't have to?
  • Communication. Nerd out about stuff. Show you're proud of what you've done, you're amped about what they're doing, and you have opinions about languages and workflows.
  • STAR (Situation, Task, Action, Result). It’s good to have a project in your back pocket that you can talk about in a direct and concise way.

Coding Question

Keybase proof

I hereby claim:

  • I am vicyap on github.
  • I am vicyap (https://keybase.io/vicyap) on keybase.
  • I have a public key ASAyETxNQXy6jPG1_2vhlRH-vYPnA2GI2sAF9nKrM4fVzQo

To claim this, I am signing this object:

@vicyap
vicyap / main.go
Last active January 18, 2020 17:21
catch-all-python-go
package main
import (
"fmt"
)
func main() {
defer func() {
if p := recover(); p != nil {
fmt.Printf("%v\n", p)
@vicyap
vicyap / gpumon.service
Created December 16, 2021 19:25
AWS gpumon
[Unit]
Description=gpumon service
After=network-online.target
Requires=network-online.target
[Service]
TimeoutStartSec=0
Restart=always
ExecStart=/usr/bin/python /opt/gpumon/gpumon.py
@vicyap
vicyap / karpenter-launch-templates.tf
Created January 19, 2022 16:35
Karpenter with Custom Launch Templates
data "aws_ami" "aws_eks_gpu_optimized" {
owners = ["602401143452"]
most_recent = true
filter {
name = "name"
values = ["amazon-eks-gpu-node-${var.eks_cluster_version}-v20220112*"]
}
}
from pprint import pprint
import ray
ray.init("ray://mycluster.internal:10001")
@ray.remote
def task():
import time
time.sleep(30)
======== Autoscaler status: 2022-02-08 09:02:10.177916 ========
Node status
---------------------------------------------------------------
Healthy:
1 head
1 wkr-15cpu30g-ondemand
Pending:
(no pending nodes)
Recent failures:
(no failures)
import logging
import ray
@ray.remote
def task():
import time
time.sleep(30)
import ray
import time
import logging
ray.init(address="auto", logging_level=logging.DEBUG)
remote_args = {
"num_cpus": 1,
"num_gpus": None,
"max_calls": 0,
"max_retries": 3,