Skip to content

Instantly share code, notes, and snippets.

View jlouros's full-sized avatar

João Louros jlouros

View GitHub Profile
@jlouros
jlouros / delete-tags-by-name.ps1
Created July 31, 2020 10:25
delete all Docker image tags by name
$searchString = 'imageName'
docker images --format '{{ .Repository }}:{{ .Tag }}' | ? { $_ -match $searchString } | % { docker rmi $_ }
@jlouros
jlouros / install-vim.ps1
Last active August 5, 2020 09:28
install vim on Windows
mkdir /vim
mkdir /tmp
Push-Location /tmp
curl.exe https://ftp.nluug.nl/pub/vim/pc/vim82w32.zip -o vim.zip
Expand-Archive .\vim.zip
Copy-Item .\vim\vim\vim82\vim.exe /vim
$Env:PATH += ';C:\vim'
Pop-Location
@jlouros
jlouros / get-all_tags_of_Docker_image.ps1
Created January 20, 2020 17:42
get all tags for a docker image on a remote registry
param (
[Parameter (Mandatory=$true)]$ImageName,
[Parameter (Mandatory=$false)]$RegistryURL
)
if (!$RegistryURL)
{
$RegistryURL = "https://registry.hub.docker.com/v1/repositories"
}
@jlouros
jlouros / Show-JsonPaths.ps1
Created August 13, 2019 10:05
Outputs all JSON paths for a given JSON file
function Show-JsonPaths {
param(
[Parameter(Mandatory = $true)]
[System.Object]$custobj,
[string] $JPath = "$",
[switch] $OutputValues
)
foreach ($k in ($custobj | Get-Member -MemberType NoteProperty).Name) {
$isCustomType = $($custobj.$k -is [System.Management.Automation.PSCustomObject])
@jlouros
jlouros / repositories.json
Created May 30, 2018 13:38
configuration file used to automatically clone git repositories
[
{"repositoryName" : "jlouros/StashApiCSharp"},
{"repositoryName" : "jlouros/PowerShell-toolbox"},
# {"repositoryName" : "jlouros/angular-auth-oidc-client"},
# {"repositoryName" : "jlouros/idtoken-verifier"},
# {"repositoryName" : "jlouros/auth0.js"},
{"repositoryName" : "jlouros/MultiSubnetFailover-TestApp"},
{"repositoryName" : "jlouros/QrCodeGenerator-ChromeExtension"},
{"repositoryName" : "jlouros/Little-Ufo-WinPhone8"},
{"repositoryName" : "jlouros/WalkCompanion-WinPhone8"},
@jlouros
jlouros / Create-SelfSigned-Certificate.ps1
Created November 24, 2017 17:19
Create self-signed certificate for localhost
#Replace "Subject" with CN (Common Name) and/or SAN (Subject Alternative Name)
New-SelfSignedCertificate -DnsName localhost -CertStoreLocation Cert:\LocalMachine\My
#Replace "Password" with your password.
$CertPassword = ConvertTo-SecureString -String "yourpassword" -Force –AsPlainText
#Replace "Thumbprint" with certificate Thumbprint and "path-to-pfx" the location where the certificate PFX will be saved.
Export-PfxCertificate -Cert cert:\LocalMachine\My\{thumbprint} -FilePath {path-to-cert-output.pfx} -Password $CertPassword
@jlouros
jlouros / delete-all-git-branches-except-master.ps1
Created November 3, 2017 10:30
Deletes all local Git branches except 'master'
git branch | Where-Object { $_ -notmatch 'master' } | ForEach-Object { git branch "$_".Trim() -D }
@jlouros
jlouros / aws.upload-folder-to-s3.js
Last active September 8, 2023 22:48
Upload folder to S3 (Node.JS)
const AWS = require("aws-sdk"); // from AWS SDK
const fs = require("fs"); // from node.js
const path = require("path"); // from node.js
// configuration
const config = {
s3BucketName: 'your.s3.bucket.name',
folderPath: '../dist' // path relative script's location
};
@jlouros
jlouros / protractor.screenshot.reporter.js
Created March 22, 2017 10:51
Protractor configuration to take screenshots on test failures (using Jasmine framework)
/* eslint import/no-extraneous-dependencies: ["off"] */
/* eslint func-names: ["off"] */
/* global browser */
/**
* Jasmine reporter used to take screenshots every time a test fails
* on your 'protractor.conf.js' (Protractor configuration file)
* include a reference to this file `const ScreenshotReporter = require('./screenshotReporter.js');`
* and hook it up inside 'onPrepare()' `jasmine.getEnv().addReporter(new ScreenshotReporter('reports/e2e-failures'));`
*/
@jlouros
jlouros / build.cake
Last active July 14, 2019 06:38
Cake build sample file
// arguments
string target = Argument("target", "Default");
string configuration = Argument("configuration", "Release");
// define directories.
ConvertableFilePath mainSln = File("./src/Example.sln");
ConvertableDirectoryPath buildDir = Directory("./src/Example/bin") + Directory(configuration);
// tasks
Task("Clean")