Skip to content

Instantly share code, notes, and snippets.

View josnidhin's full-sized avatar

Jose Davis Nidhin josnidhin

View GitHub Profile
@josnidhin
josnidhin / !SoapUI-Example
Last active June 7, 2018 11:46
A simple soap api mock using soapui
A simple soapui example.
@josnidhin
josnidhin / CSV2DynamoDBDataPipeline.json
Created July 22, 2015 02:53
A sample AWS DataPipeline configuration which loads CSV data from S3 to DynamoDB
{
"objects": [
{
"schedule": {
"ref": "DefaultSchedule"
},
"writeThroughputPercent": "0.95",
"dataFormat": {
"ref": "DynamoDBDataFormatId_suGD7"
},
@josnidhin
josnidhin / terminate_ec2_with_tags.yml
Created August 22, 2016 14:50
The ansible script to find ec2 instances with certain tags and terminate them. Does not uses ec2 dynamic inventory script.
---
- name: Terminate EC2 instances
hosts: localhost
connection: local
gather_facts: no
vars:
aws_region: "eu-west-1"
ec2_tags:
Name: "Test Server"
@josnidhin
josnidhin / nginx.conf
Last active October 28, 2021 15:28
Nginx as SMTP Proxy.
http {
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
root /var/www;
location /auth_server {
@josnidhin
josnidhin / modsec-ratelimit.conf
Created April 25, 2017 06:27
A simple mod security config for IP Rate limiting Apache server behind a load balancer.
# assumes libapache2-modsecurity is installed
# Reference Mannual - https://github.com/SpiderLabs/ModSecurity/wiki
SecRuleEngine On
<LocationMatch "^/.*">
# initialise the state based on X-Forwarded-For ip address
SecRule REQUEST_HEADERS:X-Forwarded-For "@unconditionalMatch" "phase:2,initcol:ip=%{MATCHED_VAR},pass,nolog,id:100"
@josnidhin
josnidhin / dms_task_rule.js
Created August 24, 2017 09:06
A Simple NodeJS script to generate MySQL to Redshift AWS DMS table mappings
/**
* @author Jose Nidhin
*/
'use strict';
/**
* Using Table Mapping with an Task to Select and Filter Data
* https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html#CHAP_Tasks.CustomizingTasks.TableMapping.SelectionTransformation
*/
@josnidhin
josnidhin / random_hour.js
Created April 16, 2018 02:24
A simple javascript function to generate a pseudo random hour between a start and end hour
function getRandomHour(startHour, endHour) {
if (startHour > 23 || endHour > 23) {
throw new Error('Illegal range');
}
if (startHour < 0 || endHour < 0) {
throw new Error('Illegal range');
}
if (startHour === endHour) {
@josnidhin
josnidhin / docker-container-makefile
Last active October 7, 2022 12:06
A simple makefile that I use to build and push docker containers to various AWS accounts
NAME = test-app
VERSION = latest
TEST_AWS = 111111111111
STAGE_AWS = 222222222222
PROD_AWS = 333333333333
AWS_ECR_DOMAIN = dkr.ecr.eu-west-1.amazonaws.com
# Start DO NOT EDIT SECTION
@josnidhin
josnidhin / bcrypt_password_example.pl
Created April 22, 2019 10:41
An example on how to use bcrypt to securely hash passwords in Perl
use Crypt::Eksblowfish::Bcrypt qw(bcrypt en_base64);
use Data::Entropy::Algorithms qw(rand_bits);
my $bcrypt_cost = 12;
sub encrypt_password {
my $password = shift;
my $salt = en_base64(rand_bits(16*8));
my $settings = '$2a'.'$'.$bcrypt_cost.'$'.$salt;
return bcrypt($password, $settings);
@josnidhin
josnidhin / my_ublock_filters
Last active March 6, 2020 01:00
My uBlock Filters
facebook.com
facebook.net
fb.com
fb.net
fb.me
fbcdn.com
fbcdn.net
fbsbx.com
fbsbx.net
fburl.com