Skip to content

Instantly share code, notes, and snippets.

@actionjack
actionjack / cleanup.py
Created May 2, 2018 13:23 — forked from luhn/cleanup.py
An AWS Lambda function to delete old AMIs.
"""
Code adapted from and inspired by http://blog.ranman.org/cleaning-up-aws-with-boto3/.
"""
import os
import re
from datetime import datetime, timedelta
import boto3
1. Setup a project
2. Add groovy SDK support:
https://www.bonusbits.com/wiki/HowTo:Add_Groovy_SDK_to_IntelliJ_IDEA
3. Download http://(yourjenkinsurl)/job/(yourpipelinejob)/pipeline-syntax/gdsl
- this will give you the .gdsl file - download this to the src folder of your project.
4. Finally follow this step - right click on the src folder -> Mark directory as -> Sources Root
import time
from boto.ec2.autoscale import AutoScaleConnection
def find_unused_launch_configs():
conn = AutoScaleConnection()
autoscale_groups = conn.get_all_groups(max_records=100)
launch_configs = conn.get_all_launch_configurations(max_records=100)
launch_config_names = {lc.name for lc in launch_configs}
var time = 60; var clock = 300; function TimeHack(){
setInterval(function Applytime() {
document.getElementsByClassName('timerLabel whiteTextWithShadow font-60 ng-binding')["0"].innerText = time; document.getElementsByClassName('timerLabel whiteTextWithShadow font-60 ng-binding')["0"].innerHtml = time;
document.getElementsByClassName('clockHand').rotate = clock;
}, 1);}; function TimeHackm() {
setInterval(function Addtime() {
time = time + 1;
clock = clock + 6;
}, 1000);}
var score = 1;
@actionjack
actionjack / aws-s3-policy-minimum-privs.txt
Created October 27, 2017 10:52 — forked from jackl0phty/aws-s3-policy-minimum-privs.txt
How to Create an AWS S3 Bucket, tag it, Specify Region, & Enable Versioning Using Ansible.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "statement1",
"Effect": "Allow",
"Action": [
"s3:Put*",
"s3:Get*",
"s3:List*",
@actionjack
actionjack / opt1_template.j2
Created October 20, 2017 15:11 — forked from halberom/opt1_template.j2
ansible - example of template if else
{% if filepath == /var/opt/tomcat_1 %}
{% set tomcat_value == tomcat_1_value %}
{% else %}
{% set tomcat_value == tomcat_2_value %}
{% endif %}
<Server port={{ tomcat_value }} shutdown="SHUTDOWN">
@actionjack
actionjack / Jenkinsfile
Created September 29, 2017 07:57 — forked from chinshr/Jenkinsfile
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@actionjack
actionjack / sonar.md
Created June 23, 2017 15:17 — forked from sysboss/sonar.md
SonarQube on AWS EC2 - Installation and integration with Jenkins

This article will briefly describe how to install SonarQube as Docker container on Amazon EC2 and integrate it with Jenkins.

Create database instance and user

Go to RDS > Parameter Groups
Create a new Parameter Group with the following parameter:

max_allowed_packet = 268435456

We need to create a new RDS database for SonarQube (you may use an existing MySQL instance)

  1. Go to RDS Instances
@actionjack
actionjack / README with MIT.md
Created May 10, 2017 08:34 — forked from ckib16/README with MIT.md
Default README template with the MIT license text.

QuickMarks

QuickMarks is an analytics app for web projects. It helps you track events on your websites. It is built using Rails, Devise, and a few charting libraries.

Quickmarks analytics offers a few key features:

  • A client-side JavaScript snippet that allows a user to track events on their website
  • A server-side API that captures and saves those events to a database
  • A Rails application that displays the captured event data for a user

Installation