Skip to content

Instantly share code, notes, and snippets.

View sreeram-venkitesh's full-sized avatar
☸️
kubectl scale --replicas=0 deployment/sreeram

Sreeram Venkitesh sreeram-venkitesh

☸️
kubectl scale --replicas=0 deployment/sreeram
View GitHub Profile
@sreeram-venkitesh
sreeram-venkitesh / copy-data-from-solid-cache-to-redis.rb
Last active October 12, 2024 08:31
Copying over data from Solid Cache to Redis
stats = { total: 0, success: 0, failed: 0 }
failed_entries = []
redis = Redis.new(url: ENV[Rails.application.secrets.redis_cache_url])
SolidCache::Entry.find_each(batch_size: 1000) do |item|
stats[:total] += 1
key = item.key
# We need to use Rails.cache to access Solid Cache here.
@sreeram-venkitesh
sreeram-venkitesh / prom-k8s-request-limits.md
Created April 6, 2023 14:54 — forked from max-rocket-internet/prom-k8s-request-limits.md
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
@sreeram-venkitesh
sreeram-venkitesh / okta_service.md
Created January 7, 2022 16:38
Writing a Rails service to fetch users details from Okta

fetching all users from Okta

fetchUsers = OktaService.new(path="/api/v1/apps/#{ENV["OKTA_CLIENT_ID"]}/users")
response = fetchUsers.process
render status: :ok, json: {response: response}

fetching a single user from Okta

fetchUser = OktaService.new(path="/api/v1/users/#{params[:id]}")
userResponse = fetchUser.process
@sreeram-venkitesh
sreeram-venkitesh / settings.json
Created November 1, 2021 08:27
VSCode settings.json
{
"files.autoSave": "afterDelay",
"explorer.confirmDelete": false,
//Enabled to automatically run prettier on js files when saved
"[javascript]": {
"editor.formatOnSave": true
},
"workbench.iconTheme": "helium-icon-theme",
"editor.tabSize": 2,
"editor.renderWhitespace": "all",
@sreeram-venkitesh
sreeram-venkitesh / pwm.js
Created December 1, 2020 10:42
PWM with Raspberry Pi and Node.js
const Gpio = require('pigpio').Gpio;
const led = new Gpio(17, {mode: Gpio.OUTPUT});
let dutyCycle = 0;
let interval = setInterval(() => {
led.pwmWrite(dutyCycle);
dutyCycle += 5;
@sreeram-venkitesh
sreeram-venkitesh / curriculum.md
Last active January 7, 2022 16:40
A four week study plan to get started with machine learning

Week 1

  • Revision of basic programming with Python, for loops, if-else statements, etc. Basic stuff
  • Mathematical libraries such as Numpy, Pandas, Matplotlib.

Week 2

  • Basic Machine Learning concepts
  • What is the difference between Supervised and Unsupervised learning?
  • What are Regression and Classification?
  • How do you define a Machine Learning model?
  • What do you mean by training and testing a model?]