Skip to content

Instantly share code, notes, and snippets.

View bngsudheer's full-sized avatar

Sudheer Satyanarayana bngsudheer

View GitHub Profile
@bngsudheer
bngsudheer / simple-python-program.py
Created May 19, 2022 10:56
Simple Python Program
from datetime import datetime
import time
while True:
print("Hello there, it is {}".format(datetime.now()))
time.sleep(10)
@bngsudheer
bngsudheer / busybox.yaml
Created September 6, 2020 05:10
busybox.yaml for k8s
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: default
spec:
containers:
- image: busybox:1.28.4
command:
- sleep
@bngsudheer
bngsudheer / lambda-function-to-start-stop-ec2-instances.py
Last active October 22, 2019 01:26
AWS Lambda function to start and stop ec2 instances at designated schedules
# Copyright: Sudheera Satyanarayana. 2019.
# License. Apache 2.
# You need 3 AWS components to get this to work
# 1. DynamoDB Table 2. Lambda function 3. AWS CloudWatch Event Rule that triggers the Lambda function with specific inputs
# Following code is the lambda function
# When you create the lambda function, create two environment variables named `region` and `table_name`
# `region` is your AWS region
# `table_name` is the DynamoDB table
# Assign an IAM role with permissions to start/stop EC2 instances, read from DynamoDB table and write to CloudWatch logs
# The DynamoDB table should have three columns a) instance_id (string) b) start_morining(Boolean) c) stop_evening(Boolean)
@bngsudheer
bngsudheer / redmine-inventory.yml
Created September 16, 2018 09:57
Redmine Vagrant inventory
all:
hosts:
test1
children:
webservers:
hosts:
redmine:
nginx_bind_ip: 0.0.0.0
ansible_user: vagrant
ansible_become: true
@bngsudheer
bngsudheer / redmine-playbook.yml
Created September 16, 2018 09:56
Redmine playbook
---
- name: redmine
hosts: redmine
vars:
- centos_base_enable_epel: true
- centos_base_basic_packages: true
- centos_base_selinux_packages: true
- centos_base_debug_packages: true
- centos_base_utility_packages: true
- redmine_sql_username: redmine
@bngsudheer
bngsudheer / Vagrantfile
Created September 16, 2018 09:55
Vagrantfile for Redmine
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.post_up_message = "Happy Redmine development"
config.vm.network "private_network", ip: "192.168.100.51"
config.vm.network :forwarded_port, guest: 22, host: 7101, id: 'ssh', auto_correct: false
# https://gist.github.com/amccarty/2137ae65ddada56c0865
@bngsudheer
bngsudheer / d-play.yml
Created March 4, 2018 06:04
How To Run A Docker Container Using Ansible On localhost
---
- hosts: all
tasks:
- name: Create a data container
docker_container:
name: my-test-container
image: python:2.7
command: /bin/sleep 600
@bngsudheer
bngsudheer / ansible-role-test.sh
Last active February 5, 2018 06:39 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
# - test_idempotence: whether to test playbook's idempotence (default = true)
@bngsudheer
bngsudheer / print-python-path.py
Last active October 16, 2018 05:36
Print $PYTHONPATH
python -c 'import sys; print(sys.path)'
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {