Skip to content

Instantly share code, notes, and snippets.

View Justin-Schmitz's full-sized avatar

Justin Schmitz Justin-Schmitz

View GitHub Profile
@thekvs
thekvs / gist:7d2f29404d28c9c742bf3c825e1990f5
Last active March 4, 2021 11:28
Get latest release URL from GitHub using jq
curl --silent "https://api.github.com/repos/goreleaser/goreleaser/releases/latest" | jq -r '.assets[] | select (.name|test("amd64.deb")) | .browser_download_url'
curl --silent "https://api.github.com/repos/goreleaser/goreleaser/releases/latest" | jq -r '.assets[] | select (.name|test("Linux_x86_64.tar.gz")) | .browser_download_url'
@atheiman
atheiman / User_Data.md
Last active March 21, 2024 21:15
EC2 User Data examples for Windows and Linux

EC2 User Data examples

Basic Windows local user with Administrator and RDP access

Add a local rdp user via user data at launch of a Windows EC2 instance. Note that this includes a password passed in thru both the user data and powershell command line and is a bad security practice because they can be viewed later. At a minimum, you should connect to the instance immediately after launch and change the password interactively. Also, delete the userdata from the instance after launch. More secure would be to connect the instance to a domain for authentication or use AWS native tooling to connect to the instance (e.g., AWS Session Manager).

<powershell>
# Be sure to set the username and password on these two lines. Of course this is not a good
# security practice to include a password at command line.
@Splaxi
Splaxi / download-latest-release.ps1
Last active February 11, 2024 18:13 — forked from MarkTiedemann/download-latest-release.ps1
Download latest GitHub release via Powershell
# Download latest dotnet/codeformatter release from github
$repo = "jgm/pandoc"
$filenamePattern = "*x86_64.zip"
$pathExtract = "C:\Tools\pandoc"
$innerDirectory = $true
$preRelease = $false
if ($preRelease) {
$releasesUri = "https://api.github.com/repos/$repo/releases"
@soberich
soberich / bulk_clone_bitbucket.sh
Created April 30, 2020 18:54
Bulk clone repos in Bitbucket REST Api 2.0
# prerequisites: `httpie`, `jq`, GNU's `parallel`. e.g. brew install <package>
# there is max 100 page length n pages where n is 100 length page. Execute one one by one (there is no way you'll get more than 100 times parallelization)
# in `.values[].links.clone[1].href` `1` is for SSH, where `0` would be for HTTPS.
http https://<user>:<pass>@api.bitbucket.org/2.0/repositories/<account_name> pagelen==100 page==<page_num> | jq -r '.values[].links.clone[1].href' | parallel git clone
# Voila it takes approx 1-2 minutes to clone a 100 repos.
@brosahay
brosahay / install-docker-ce.sh
Last active March 26, 2022 19:16
Docker on Ubuntu 20.04 LTS WSL
#!/bin/bash
# Install Docker-CE
sudo apt update -y
sudo apt install docker-compose -y
# Add User to Group
sudo groupadd docker
sudo gpasswd -a $USER docker
newgrp docker
@eeichinger
eeichinger / clone-repos-generate.sh
Last active December 27, 2023 10:12
Generate a script to clone all repos within a specific project from bitbucket server and bitbucket cloud
# generate a script ./clone-repos.sh from a list of repos fetched via Bitbucket API
# note: requires 'curl' and 'jq' to be installed
set -e
echo -n '' > clone-repos.sh
chmod +x clone-repos.sh
ONPREM_USER=xxxxx
ONPREM_PASS=......
@miguelfito
miguelfito / download_bitbucket_repos.sh
Last active April 25, 2022 09:05
Clone all project's git repos from Bitbucket
#!/usr/bin/env bash
# Define your bitbucket server URL
BITBUCKET_SERVER=bitbucket.organization.com
# Define your credentials
USERNAME=your_login
PASSWORD=your_password
# Save current dir
root_folder=$PWD
@TheDeveloper
TheDeveloper / cloudformation-cheatsheet.md
Created May 8, 2018 17:08
A quick reference of common CloudFormation elements

Intrinsic functions

!Ref ResourceName
{ "Fn::Ref": "ResourceName" }

!GetAtt ResourceName.AttributeName
{ "Fn::GetAtt": [ "ResourceName", "AttributeName" ] }

!Sub "something:with:${Variable}"

{ "Fn:Sub": "something:with:${Variable}" }

@shokoe
shokoe / aws_inspector_cron.sh
Last active April 14, 2023 11:39
Executes AWS Inspector run, export full findings csv file from last completed run, compile a concise counters report including severity and package aggregates by hostname. Full and aggregated report are uploaded to S3.
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/snap/bin
log="/var/log/aws_inspector/aws_inspector_export_rep.log"
template_arn='arn:aws:inspector:us-east-1:XXXXXXXXXXXX:target/xxxxxxxxxx/template/xxxxxxxxxx'
wait_sec='5400'
log_out(){
(($verifymon)) &&\
echo -e "`date +'%Y-%m-%d %H:%M:%S'` (pid $$) -- $1" >> $log ||\
echo -e "`date +'%Y-%m-%d %H:%M:%S'` (pid $$) -- $1" | tee -a $log
@davewongillies
davewongillies / Terraform_functions.md
Last active July 15, 2023 14:41
Terraform Functions

Supported built-in functions

  • abs(float) - Returns the absolute value of a given float. Example: abs(1) returns 1, and abs(-1) would also return 1, whereas abs(-3.14) would return 3.14. See also the signum function.

  • basename(path) - Returns the last element of a path.

  • base64decode(string) - Given a base64-encoded string, decodes it and returns the original string.