This file contains hidden or 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 <ctype.h> | |
| #include <string.h> | |
| #include <stdint.h> | |
| #include <errno.h> | |
| int main(int argc, char *argv[]) { | |
| FILE *file = stdin; /* file to read, default to stdin */ | |
| char text[17]; /* text representation of the 16 bytes line */ | |
| int n; /* number of bytes read in the line */ |
This file contains hidden or 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
| # NOTES | |
| # minikube is used as internal domain for ingress, feel free to change it | |
| # it's just to make it work with apps that were using that domain in minikube | |
| # but it could be anything really | |
| echo 'Installing colima' | |
| brew install colima | |
| echo 'Starting VM' | |
| colima start --cpu=8 --memory=8 --disk=100 --vm-type vz --kubernetes --network-address |
This file contains hidden or 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
| (define (true a b) a) | |
| (define (false a b) b) | |
| (define (not b) (b false true)) | |
| (define (and a b) (a b false)) | |
| (define (or a b) (a true b)) | |
| (define zero (lambda (f) (lambda (x) x))) | |
| (define one (lambda (f) (lambda (x) (f x)))) | |
| (define two (lambda (f) (lambda (x) (f (f x))))) | |
| (define three (lambda (f) (lambda (x) (f (f (f x)))))) |
This file contains hidden or 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
| # Boolean logic | |
| def true(a, _): | |
| return a | |
| def false(_, b): | |
| return b | |
| def not_f(b): | |
| return b(false, true) |
This file contains hidden or 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> | |
| #include <string.h> | |
| #include <sys/socket.h> | |
| #include <netinet/in.h> | |
| #include <arpa/inet.h> | |
| #include <unistd.h> | |
| #include <sys/epoll.h> | |
| #define BUFFER_SIZE 256 |
This file contains hidden or 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 | |
| set -ex | |
| CONTROLLER_BUS_ID=0000:00:01.0 | |
| DEVICE_BUS_ID=0000:01:00.0 | |
| sudo tee /sys/bus/pci/devices/${CONTROLLER_BUS_ID}/power/control <<<on | |
| sleep 1 | |
| sudo tee /sys/bus/pci/rescan <<<1 |
This file contains hidden or 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 | |
| set -ex | |
| CONTROLLER_BUS_ID=0000:00:01.0 | |
| DEVICE_BUS_ID=0000:01:00.0 | |
| if sudo lsof /dev/nvidia0 ; then | |
| echo 'Some processes are still using the card, aborting.' | |
| exit 1 | |
| fi |
This file contains hidden or 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 | |
| # Use the temporary credentials from the MFA profile to update the | |
| # registry-creds plugin credentials used to pull images from AWS Elastic | |
| # Container Registry | |
| # | |
| # NOTE: the script won't request fresh credentials, make sure your credentials | |
| # are not expired before running this script | |
| # retrieve the profile from the credentials file | |
| content=$(grep -F -A 5 '[mfa]' < ~/.aws/credentials) |
This file contains hidden or 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 bash | |
| set -eux | |
| # used to process output with awk | |
| export AWS_DEFAULT_OUTPUT=text | |
| disable_cluster_autoscaler() { | |
| # delete the tag from the autoscaling group | |
| aws autoscaling delete-tags \ | |
| --tags ResourceId=$1,ResourceType=auto-scaling-group,Key=k8s.io/cluster-autoscaler/enabled |
This file contains hidden or 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 ruby | |
| require "json" | |
| require "aws-sdk-ec2" | |
| # Usage: bundle exec ruby find-orphan-pods.rb <cluster-name> | |
| # NOTE: make user to point kubectl to the right context! | |
| # | |
| # Returns a list of pods which aren't using an attached ENI and so don't have | |
| # network connectivity |
NewerOlder