Skip to content

Instantly share code, notes, and snippets.

@gotunandan
gotunandan / WireGuard-site-to-site.md
Created May 30, 2020 06:31
Accessing a subnet that is behind a WireGuard client using a site-to-site setup

WireGuard Site-to-Site

Accessing a subnet that is behind a WireGuard client using a site-to-site setup

Problem Summary

We want to access a local subnet remotely, but it is behind a NAT firewall and we can't setup port forwarding. Outgoing connections work, but all incoming connections get DROPPED by the ISP's routing policy.

Solution Summary

@gotunandan
gotunandan / index.js
Created May 30, 2020 05:57 — forked from dcpesses/index.js
HTTPS Proxy Server in node.js
// via http://stackoverflow.com/questions/8165570/https-proxy-server-in-node-js
// Install npm dependencies first
// npm init
// npm install --save [email protected]
// npm install --save [email protected]
// node ./index.js
var httpProxy = require("http-proxy");
var http = require("http");
var url = require("url");
var net = require('net');
@gotunandan
gotunandan / ec2_info_retriever.py
Created May 16, 2020 12:27 — forked from dastergon/ec2_info_retriever.py
A basic boto3 based tool for retrieving information from running EC2 instances.
from collections import defaultdict
import boto3
"""
A tool for retrieving basic information from the running EC2 instances.
"""
# Connect to EC2
ec2 = boto3.resource('ec2')
@gotunandan
gotunandan / aws-s3-buckets-with-tags.sh
Created March 18, 2020 06:12 — forked from filipenf/aws-s3-buckets-with-tags.sh
Print a list of aws buckets along with their tags
#!/bin/bash
# lists all buckets along with their tags in the following format:
# bucket_name | { tag_name: tag_value }
# depends on AWS CLI and JQ
for bucket in `aws s3api list-buckets | jq .Buckets[].Name | tr -d \"`; do
tags=$(aws s3api get-bucket-tagging --bucket $bucket | jq -c '.[][] | {(.Key): .Value}' | tr '\n' '\t')
echo $bucket '|' $tags
done
@gotunandan
gotunandan / preapprove.groovy
Created November 25, 2019 14:14 — forked from tknerr/preapprove.groovy
pre-approve all pending script approvals, e.g. from a JobDSL script
import jenkins.*
import jenkins.model.*
Jenkins.instance.getExtensionList('org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval')[0].get().preapproveAll()
@gotunandan
gotunandan / .gitignore
Created October 23, 2019 14:19 — forked from hfs/.gitignore
How to keep Jenkins configurations in a git repository. Put .gitignore in Jenkins’ home directory (/var/lib/jenkins). Initialize a git repository and add a remote to push to. Create a new Jenkins job to run e.g. nightly with the content of backup.sh as shell execution build step.
# Non-config file types
*.log
*.log.*
*.tmp
*.old
*.bak
*.jar
*.jpi
*.jpi.pinned
*.json
@gotunandan
gotunandan / jenkins-home-git.sh
Created October 23, 2019 14:18 — forked from cenkalti/jenkins-home-git.sh
Backup Jenkins home periodicallly with git.
#!/bin/bash
# Setup
#
# - Create a new Jenkins Job
# - Mark "None" for Source Control Management
# - Select the "Build Periodically" build trigger
# - configure to run as frequently as you like
# - Add a new "Execute Shell" build step
# - Paste the contents of this file as the command
@gotunandan
gotunandan / lvmount.sh
Created September 18, 2019 11:31 — forked from gilfreund/lvmount.sh
Automatically mount EC2 free ephemeral disks into an LVM group
#!/bin/bash
# based on code byLeon Mergen
# see: https://leonmergen.com/automatically-mounting-instance-store-on-an-aws-ami-150da3ffd041
LVDISPLAY="/sbin/lvdisplay"
PVCREATE="/sbin/pvcreate"
VGCREATE="/sbin/vgcreate"
LVCREATE="/sbin/lvcreate"
MKFS="/sbin/mkfs -t xfs"
MOUNTPOINT="/mnt/data"
require 'curb'
require 'json'
$url = "http://google.com"
$selhost = "http://localhost:4444/wd/hub/"
def curl_delete(paramas, map)
url_path = $selhost + map
* Use parental controls from Users and Groups to Limit access applications
* Enable Simple Finder
* Remove the Dock from /System/Library/CoreServices/Dock.app/
* Remove these lines from the file -
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/StandardMenus.nib/objects.xib