Skip to content

Instantly share code, notes, and snippets.

View Sadamingh's full-sized avatar

Adam Sadamingh

View GitHub Profile
@Sadamingh
Sadamingh / etcdclient.yaml
Last active March 13, 2023 22:37
A etcd client used for Minikube
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
component: etcdclient
tier: debug
name: etcdclient
namespace: kube-system
spec:
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#define FIFO_FILE "/tmp/myfifo"
int main()
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
def constrained_sum(nums: List[int]) -> int:
current, previous = 0, 0
for value in nums:
previous, current = current, max(current, previous + value)
return current
def my_gcd(a: int, b: int) -> int:
while b:
a, b = b, a % b
return abs(a)
def fib(n: int) -> List[int]:
fib_seq = [0, 1]
while len(fib_seq) < n:
fib_seq.append(sum(fib_seq[-2:]))
return fib_seq
def bound_value(value: float, min_value: float, max_value: float) -> float:
return min(max_value, max(value, min_value))
bound_value(235, min_value=0, max_value=255)
def reverse_string(string: str) -> str:
if string == "":
return ""
else:
return string[-1] + reverse_string(string[:-1])
reverse_string("stressed")
def len_list(seq):
if seq == []:
return 0
else:
return 1 + len_list(seq[:-1])
len_list([1, 2, 3])
def len_list(seq):
if seq == []:
return 0
else:
return 1 + len_list(seq[:-1])
len_list([1, 2, 3])