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
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
@adamwiggins
adamwiggins / adams-heroku-values.md
Last active November 5, 2024 21:40
My Heroku values

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@peterhurford
peterhurford / open-source.md
Last active February 5, 2022 08:51
What is on an open source project website?: Five case studies

What is on an open source project website?: Five case studies

Looking at Rails, Angular, jQuery, Prediction.io, and Redis pages to find commonalities.

Lessons Learned

  • Layout matters. A nice layout inspires trust in your project.
  • Layout is similar. All the sites had a top bar with the prominent navigation. All the main pages had introductory text.
  • GitHub Issues is used ubiquitously for bug tracking.
  • IRC seems important for communities. Gitter seems like a good choice.
@peterhurford
peterhurford / parallelization.md
Created October 17, 2015 22:04
How does code get parallelized?

Computer code is a series of executed statements. Frequently, these statements are executed one at a time. If one part of your code takes a long time to run, the rest of your code won't run until that part is finished.

However, this isn't how it has to be. We can often make the exact same code go much faster through parallelization, which is simply running different parts of the computer code simaltaneously.

Asynchronous Code

The first example of this is asynchronous code. The idea here is that many times you do things like send a call to another computer, perhaps over the internet, using an API. Normally, code then has to simply wait for the other computer to give it a response over the API. But asynchronous code can simply keep on going and then the API call returns later.

This makes code harder to reason about and handle because you don't know when the API call will return or what your code will be like when it returns, but it makes your code faster because you don't have to wait arou

@peterhurford
peterhurford / readable-code.md
Last active September 23, 2024 09:45
How do you write readable code?: 13 Principles

How do you write readable code?: 13 Principles

"Programs should be written for people to read, and only incidentally for machines to execute." -- Structure and Interpretation of Computer Programs

"How would you define good code? [...] After lots of interviews we started wondering if we could come out with a definition of good code following a pseudo-scientific method. [...] The population is defined by all the software developers. The sample consists of 65 developers chosen by convenience. [...] The questionnaire consists in a single question: “What do you feel makes code good? How would you define good code?”. [...] Of those, the most common answer by far was that the code has to be Readable (78.46%), almost 8 of each 10 developers believe that good code should be easy to read and understand." -- "What is Good Code: A Scientific Definition"

@peterhurford
peterhurford / git-101-exercises.md
Last active July 29, 2023 04:30
Git 101, with Exercises

Git 101, with Exercises

Git is the key tool we use to allow multiple people to work on the same code base. Git takes care of merging everyone's contributions smoothly. Hence, learning how to use Git is critical to contributing to open source.

Exercises

Exercise 1: Go through the Try Git Guide

Exercise 2: Learn How to file a github issue.

@troyharvey
troyharvey / deployment.yml
Last active September 13, 2024 19:00
Using Kubernetes envFrom for environment variables
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
@bradtraversy
bradtraversy / myscript.sh
Last active November 9, 2024 02:10
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@max-rocket-internet
max-rocket-internet / prom-k8s-request-limits.md
Last active November 11, 2024 08:40
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) /
let rects = [];
function visualize(analyser) {
analyser.fftSize = 2048;
var bufferLength = analyser.fftSize;
var dataArray = new Uint8Array(bufferLength);
function run() {
analyser.fftSize = 2048;
var bufferLengthAlt = analyser.frequencyBinCount;