Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Time for some Actions! :D

Michael managedkaos

💭
Time for some Actions! :D
View GitHub Profile
@managedkaos
managedkaos / azlyrics.py
Created Aug 1, 2017
Scrape lyrics from azlyrics.com
View azlyrics.py
import requests
from bs4 import BeautifulSoup
url = "http://www.azlyrics.com/lyrics/onyx/bacdafucup.html"
print "Default request (it will fail)..."
# make the default request
try:
r = requests.get(url)
View 0-file.txt
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut velit eros, lobortis a sem et, semper imperdiet quam. Morbi vitae mauris congue, laoreet tortor et, tincidunt nunc. Vestibulum pulvinar, erat ut laoreet bibendum, nunc velit semper dui, non euismod enim risus vitae sapien. Vivamus ultrices consequat urna in commodo. Sed mattis, lectus vestibulum faucibus viverra, lacus orci lacinia erat, quis bibendum nisl libero a ipsum. Praesent mollis a mi non vestibulum. Duis vel arcu purus. Curabitur ornare tortor vel convallis efficitur. Donec tempus massa eget imperdiet cursus. Quisque purus leo, varius eget mollis eu, blandit vitae quam. Vivamus egestas interdum sollicitudin. In vitae nulla diam. Morbi ante leo, tristique eu rutrum in, tempus et justo.
Nunc sed massa magna. Quisque vestibulum cursus nisl vitae malesuada. Maecenas id neque eu quam facilisis vehicula. Cras tempus consectetur eros a lobortis. Nunc semper iaculis lectus. Quisque at nunc vel ligula eleifend posuere at eget ex. Vivamus varius maur
View 100days.py
#!/usr/local/bin/python3
from datetime import date
import os, requests
start = date(2020, 12, 31)
today = date.today()
delta = today - start
if (delta.days < 101):
print("Today is day {}".format(delta.days))
View context.text
"#<LambdaContext:0x000055e3817a4030 @clock_diff=1611091363834, @deadline_ms=1611091662175, @aws_request_id=\"ddd82629-22a9-4e2e-a84d-ad85b359e192\", @invoked_function_arn=\"arn:aws:lambda:us-east-1:388085464911:function:apimachine-staging\", @log_group_name=\"/aws/lambda/apimachine-staging\", @log_stream_name=\"2021/01/19/[$LATEST]a2b2b90da5d146b6a01531ae7cc035c1\", @function_name=\"apimachine-staging\", @memory_limit_in_mb=\"128\", @function_version=\"$LATEST\">"
@managedkaos
managedkaos / dynamic-vpc-import.tf
Created Nov 24, 2020
Import an AWS VPC using just the VPC ID. Public and Private subnets are imported dynamically using filtering.
View dynamic-vpc-import.tf
variable "vpc_id" {
type = string
default = "vpc-12345678"
}
data "aws_vpc" "vpc" {
id = var.vpc_id
}
data "aws_subnet_ids" "public" {
@managedkaos
managedkaos / jenkins_on_docker.sh
Created Sep 11, 2020
A `bash` function for running the Jenkins CI LTS image as a docker process.
View jenkins_on_docker.sh
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
@managedkaos
managedkaos / requirements.txt
Created Apr 19, 2019
System libs for Python
View requirements.txt
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
View 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"
View docker-install-ubuntu-1804.sh
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 Jun 13, 2018
Run Jenkins on Docker
View jenkinsondocker.sh
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