Skip to content

Instantly share code, notes, and snippets.

View managedkaos's full-sized avatar
💭
Time for some Actions! :D

Michael managedkaos

💭
Time for some Actions! :D
View GitHub Profile
@managedkaos
managedkaos / dynamic-vpc-import.tf
Created November 24, 2020 03:23
Import an AWS VPC using just the VPC ID. Public and Private subnets are imported dynamically using filtering.
variable "vpc_id" {
type = string
default = "vpc-12345678"
}
data "aws_vpc" "vpc" {
id = var.vpc_id
}
data "aws_subnet_ids" "public" {
@managedkaos
managedkaos / requirements.txt
Created April 19, 2019 17:44
System libs for Python
adal==1.2.1
ansible==2.7.1
appnope==0.1.0
argcomplete==1.9.3
asn1crypto==0.24.0
astroid==1.6.5
atomicwrites==1.3.0
attrs==19.1.0
aws==0.2.5
awscli==1.16.138
@managedkaos
managedkaos / Brewfile
Created April 18, 2019 00:17
Brewfile
tap "codeship/taps"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-drivers"
tap "homebrew/core"
tap "homebrew/services"
tap "jenkins-x/jx"
tap "wallix/awless"
cask "java"
brew "ack"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-cache policy docker-ce
apt-get install -y docker-ce
systemctl status docker
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
@managedkaos
managedkaos / jenkinsondocker.sh
Created June 13, 2018 21:48
Run Jenkins on Docker
function jenkinsondocker() {
if [ $(ps -elf | grep docker | wc -l) -gt 0 ];
then
echo -n $(docker stop jenkins 2>&1) | sed 's/Error response from daemon://'
echo -n $(docker rm jenkins 2>&1) | sed 's/Error response from daemon://'
docker pull jenkins/jenkins:lts
docker run --detach --publish 49000:8080 --name jenkins jenkins/jenkins:lts
echo -n "Waiting for Jenkins process to start ."
until [ $(curl -o /dev/null --silent --head --write-out '%{http_code}\n' http://127.0.0.1:49000) -eq 403 ]; do echo -n '.'; sleep 1; done
echo
/usr/local/bin/docker stop ${CONTAINER_NAME} || echo "no container to stop"
/usr/local/bin/docker rm ${CONTAINER_NAME} || echo "no container to remove"
# the insecure, no plugins install (skips the setup wizard)
/usr/local/bin/docker run \
-e 'JAVA_OPTS="-Djenkins.install.runSetupWizard=false"' \
--detach \
--publish ${PORT_NUMBER}:8080 \
--name ${CONTAINER_NAME} jenkins
@managedkaos
managedkaos / fizzbuzz.pl
Created August 8, 2017 03:11
FizzBuzz implemented in Perl.
#!/usr/bin/env perl
foreach $number (1..100) {
$three = 0;
$five = 0;
if (($number % 3) == 0) {
print 'Fizz';
$three = 1;
}
#!/usr/bin/env perl
# read the input
@data = split /\s+/, <STDIN>;
@data = sort @data;
map { $min += $_ } @data[0 .. ($#data - 1)];
map { $max += $_ } @data[1 .. $#data];
print "$min $max\n";
#!/usr/bin/env perl
# read the input file
@input = <>;
# initialize the scores
@score = qw(0 0);
# split the input into arrays
foreach $i (0..1) {
arrays = [ [1,7], [2,3,4], [10,11,12,13] ]
while arrays:
for (index, item) in enumerate(arrays):
if len(arrays[index]) == 0:
arrays.pop(index)
continue
print arrays[index].pop(0)
print arrays