Skip to content

Instantly share code, notes, and snippets.

@andrx
andrx / resources.tf
Created December 12, 2019 05:45 — forked from justinsoliz/resources.tf
Terraform S3 to Lambda notification
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
resource "aws_iam_role" "iam_for_terraform_lambda" {
name = "app_${var.app_env}_lambda"
assume_role_policy = <<EOF
{
@andrx
andrx / remove_merged_branches_remotely.ps1
Created September 15, 2017 20:26
git. Remove all remote branches merged into 'master' using powershell without checking them out
git branch -r --merged master | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'stage' -and $_ -notmatch 'master'} | %{git branch -d -r $_; if($?){ git push origin $_.Replace("origin/",":refs/heads/")}}
@andrx
andrx / tlrecode.sh
Created September 7, 2017 05:04 — forked from NikitaKarnauhov/tlrecode.sh
Shell script to decode and encode TP-LINK router config files
#!/usr/bin/env bash
# tlrecode.sh
# Decode and encode TP-LINK router config files.
#
# Creative Commons CC0 License:
# http://creativecommons.org/publicdomain/zero/1.0/
#
# To the extent possible under law, the person who associated CC0 with this
# work has waived all copyright and related or neighboring rights to this work.
<#
.SYNOPSIS
Gets a PowerShell Credential (PSCredential) from the Windows Credential Manager
.DESCRIPTION
Adapted from: http://stackoverflow.com/questions/7162604/get-cached-credentials-in-powershell-from-windows-7-credential-manager
.PARAMETER TargetName
The name of the target login informations in the Windows Credential Manager
@andrx
andrx / remove_remote_branches.ps1
Last active April 4, 2022 14:26
git. Remove all remote branches except 'master' and 'develop' on powershell without checking them out
git branch -a | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'} | %{$_.Replace("remotes/","")} | %{git branch -d -r $_ ; if($?){ git push origin $_.Replace("origin/",":refs/heads/")}}
@andrx
andrx / list_certs.ps1
Created October 27, 2016 19:23
Update SSL certificate for IIS Website binding
dir cert:\localmachine\my
''
'Get the certificate''s Thumbprint'
Pause
@andrx
andrx / AESGCM.cs
Created November 26, 2015 22:02 — forked from jbtule/AESGCM.cs
I have two code examples that I wrote for best practices encrypting a string in c#. They are both using authenticated encryption. http://stackoverflow.com/a/10366194/637783
/*
* This work (Modern Encryption of a String C#, by James Tuley),
* identified by James Tuley, is free of known copyright restrictions.
* https://gist.github.com/4336842
* http://creativecommons.org/publicdomain/mark/1.0/
*/
using System;
using System.IO;
using System.Text;