This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import yaml | |
STORAGE_SIZE = "1Gi" | |
def create_pv_yaml(name, storage_size, path, node): | |
pv = { | |
"apiVersion": "v1", | |
"kind": "PersistentVolume", | |
"metadata": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
slice := []string{"ena", "dyo"} | |
iterator := cyclicIterator(slice) | |
for i := 0; i < 10; i++ { | |
fmt.Println(iterator()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pprint | |
import click | |
import json | |
''' | |
@click.group(<name>) creates a command that instantiates a group class | |
a group is intended to be a set of related commands | |
@click.argument(<argument name>) tells us that we will be passing an argument | |
and referring to that argument in the function by the name we pass it | |
@click.pass_context tells the group command that we're going to be using |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
solve ← ∧/0=(≢ |⊢∘≢ ⌸∘∊) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require 2htdp/image) | |
(define(serp d) | |
(if (zero? d) | |
(triangle 1 'solid 'green) | |
(above (serp (sub1 d)) | |
(beside (serp (sub1 d)) | |
(serp (sub1 d)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Enabling ipv4 forwarding (cleaning old rules)" | |
# flushing old rules -- USE WITH CARE | |
iptables --flush | |
iptables --table nat --flush | |
# MASQUERADE each request form the inside to the outer world | |
iptables -t nat -A POSTROUTING -j MASQUERADE | |
# enable IPv4 packet forwarding in the kernel | |
echo 1 > /proc/sys/net/ipv4/ip_forward |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
import sys | |
import random | |
f = open(sys.argv[1], "r") | |
people = f.readlines() | |
people = list(map(lambda person: person.replace('\n', ''), people)) | |
identifiers = list(range(len(people))) | |
random.shuffle(identifiers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
//Declare infinite limit for the DP array | |
//all the valid answers in the DP array are NUMBER % 1000000009 so smaller than this number | |
#define limit 1000000010 | |
int N, K, B; | |
//Steps you can take | |
int *Steps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
//Structure to save Height and Position of each station | |
struct station_struct { | |
long height; | |
long position; | |
}; | |
//Quicksort comparator |