Skip to content

Instantly share code, notes, and snippets.

@dduvnjak
dduvnjak / getStackOutputs.js
Last active April 1, 2024 09:03 — forked from kwilczynski/getStackOutputs.js
Get outputs from a stack by name in CloudFormation. Uses AWS SDK v3, compatible with Node.js 20.x runtime.
'use strict';
const { CloudFormationClient, DescribeStacksCommand } = require('@aws-sdk/client-cloudformation');
const { HttpRequest } = require('@aws-sdk/protocol-http');
const { NodeHttpHandler } = require('@aws-sdk/node-http-handler');
const url = require('node:url');
async function getStackOutputs(properties) {
if (typeof properties.StackName === 'undefined') {
throw new Error('The StackName property was not specified.');
#!/bin/bash
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
@dduvnjak
dduvnjak / .ronquotes.sh
Last active May 8, 2023 10:09
Ron Swanson quote generator in Bash. Source it in your ~/.bash_profile for a steady supply of wisdom and small government advocacy.
#!/usr/bin/env bash
# set the quotes
quotes=$(cat <<-END
"Clear alcohols are for rich women on diets."
"Crying: acceptable at funerals and the Grand Canyon."
"I call this turf ‘n’ turf. It's a 16 oz T-bone and a 24 oz porterhouse. Also, whiskey and a cigar. I am going to consume all of this at the same time because I am a free American."
"Under my tutelage, you will grow from boys to men. From men into gladiators. And from gladiators into Swansons."
"I'm a simple man. I like pretty, dark-haired women, and breakfast food."
"Never half-ass two things. Whole-ass one thing."
@dduvnjak
dduvnjak / add_cloudflare_ips.sh
Last active March 7, 2024 15:18
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# set the security group ID
SG_ID="sg-00000000000000"
# iterate over the IP ranges in the downloaded file
# and allow access to ports 80 and 443
while read p
do
@dduvnjak
dduvnjak / newrelic.config
Created May 16, 2016 18:26
Installs and configures New Relic System Monitoring agent on AWS Elastic Beanstalk instances
# installs and configures New Relic System Monitoring agent
#
files:
"/opt/elasticbeanstalk/get-eb-env-name.py":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env python
import boto.utils
@dduvnjak
dduvnjak / pre-commit
Last active September 26, 2023 00:29 — forked from DmZ/pre-commit
Git pre-commit hook to search for Amazon AWS API keys.
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=5da2c1fe8f6458e32d11110e0ebdd915e472c6e0
fi
@dduvnjak
dduvnjak / wildfly-install.sh
Last active December 2, 2015 22:46 — forked from sukharevd/wildfly-install.sh
Script to install JBoss Wildfly 10.x as service in Linux
#!/bin/bash
#title :wildfly-install.sh
#description :The script to install Wildfly 10.x
#more :http://sukharevd.net/wildfly-8-installation.html
#author :Dmitriy Sukharev
#date :2015-10-24T17:14-0700
#usage :/bin/bash wildfly-install.sh
#tested-version :10.0.0.CR3
#tested-distros :Debian 7,8; Ubuntu 15.10; CentOS 7; Fedora 22
@dduvnjak
dduvnjak / .ebextensions--01phantom.config
Last active October 28, 2017 15:25
Elastic Beanstalk configuration file for installing phantomjs globally
files:
"/opt/elasticbeanstalk/nodepath.rb":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env ruby
require 'json'
cc = "/opt/elasticbeanstalk/deploy/configuration/containerconfiguration"
j = JSON.parse(File.read(cc))
@dduvnjak
dduvnjak / apache_mod_jk_win.md
Created January 27, 2014 01:01
Set up mod_jk with Apache on Windows

Download and install Apache from:
http://www.apache.org/dist/httpd/binaries/win32/httpd-2.2.25-win32-x86-openssl-0.9.8y.msi

download mod_jk for windows: http://apache.mirrors.pair.com//tomcat/tomcat-connectors/jk/binaries/windows/tomcat-connectors-1.2.37-windows-i386-httpd-2.2.x.zip

extract and put it in the modules folder:
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\modules

Add this to the httpd.conf file (located at C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf)

@dduvnjak
dduvnjak / .rdebugrc
Created August 22, 2013 13:36
Quick Ruby debug (thanks to @hkraji)
set autolist
set autoeval
set autoreload
set listsize 20