Skip to content

Instantly share code, notes, and snippets.

View srleyva's full-sized avatar

Stephen Leyva srleyva

  • Seattle, WA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am srleyva on github.
  • I am sleyva (https://keybase.io/sleyva) on keybase.
  • I have a public key ASBJQWyB_ZirpgacbgBuzZIFejsDaPWLYLzvKW7kGX81iwo

To claim this, I am signing this object:

@srleyva
srleyva / deploy.yaml
Created April 6, 2018 13:25
Mount Directories in k8s for debugging
apiVersion: v1
kind: Pod
metadata:
name: test-ebs
spec:
containers:
- image: nginx
name: test-container
volumeMounts:
- mountPath: /test/var/
@srleyva
srleyva / russianpeasant.go
Last active May 23, 2018 13:38
Russian Peasant algorithm go
package main
import (
"fmt"
"time"
)
func main() {
num1 := 2000000000
package main
import (
"fmt"
"sort"
)
func main() {
cache := make(map[int]int)
for i := 1; i < 50; i++ {
---
apiVersion: v1
kind: ConfigMap
metadata:
name: redis-cluster
labels:
app: redis-cluster
data:
fix-ip.sh: |
#!/bin/sh

Subnetting

What is an IP?

Unique address that machines have.

192 . 168 . 1 . 10 1100000.10101000.00000001.00001010

Creating the toolchain

We must build from source as our OS does not have a package manager.

  • configure - will create a Makefile based off of user input. Checks for appropriate dependancies and compilers.
  • make - calls compilers and complies the code.
  • make install - copies compiled binaries to correct location

Bootstrapping is essentially using host OS tools (without creating dependancies on the host) to create a temporary toolchain in the LFS env. This allows us to use a temporary toolchain to build our OS.

package main
import (
"fmt"
"math/rand"
"time"
)
type Job struct {
Name string
@srleyva
srleyva / backoff.py
Created February 4, 2020 21:54
Pluggable backoff class
import time
class BackOff:
def __init__(self, backoff_type='fib', retries=10):
self._backoff_type = backoff_type
self.retries = retries
self._backoff_generator = None
// This powerful wrapper provides the ability to store a positive integer value.
// Rewrite it using generics so that it supports wrapping ANY type.
struct Wrapper<T> {
value: T
}
impl<T> Wrapper<T> {
pub fn new(value: T) -> Wrapper<T> {
Wrapper { value }