Skip to content

Instantly share code, notes, and snippets.

View johnbianchi's full-sized avatar

John Bianchi johnbianchi

View GitHub Profile
#!/usr/bin/env python
import argparse
import sys
from collections import Counter
def main(paths, n=100):
counter = Counter()
for path in paths:
print(path)
@mhitza
mhitza / workflow.md
Last active April 12, 2022 12:54
Faster Ansible playbook iteration with tags and Vagrant snapshots

In the last few months, I had to write multiple Ansible playbooks, to the point that the slow write/test cycle became a major annoyance. What seemed to work well for me was a mix between Ansible tags and Vagrant snapshots. I would be happy to hear what workflow others employ, that specifically minimizes the time they spend testing.

Setup

Vagrantfile

Vagrant.configure("2") do |config|
@jdhitsolutions
jdhitsolutions / New-WindowsTerminalProfile.ps1
Last active November 5, 2019 04:04
A proof of concept PowerShell function to add a new profile to the Windows Terminal Preview (0.2.1831.0).
Function New-WindowsTerminalProfile {
[cmdletbinding(SupportsShouldProcess)]
Param(
[Parameter(Position = 0, Mandatory)]
[ValidateNotNullOrEmpty()]
[alias("name")]
[string]$ProfileName,
[Parameter( Mandatory)]
[ValidateNotNullOrEmpty()]
@sebagomez
sebagomez / enable_https.ps1
Created February 1, 2019 15:23
Enable https via PowerShell
$cert = (New-SelfSignedCertificate -DnsName localhost -CertStoreLocation cert:Localmachine\My).Thumbprint
New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https
Get-Item cert:\LocalMachine\MY\$cert | New-Item IIS:\SslBindings\0.0.0.0!443
@bohwaz
bohwaz / gitlab-projects-json-to-csv.php
Created February 8, 2017 01:23
Extract Gitlab JSON project list and convert it to CSV
<?php
$projects = [];
$projects[] = [
'Project path',
'Owner',
'Name',
'Description',
'Created',
@BretFisher
BretFisher / docker-cli-tips-and-tricks.md
Last active December 6, 2023 19:49
Docker CLI Tips and Tricks
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@shadyvb
shadyvb / .gitconfig
Created May 24, 2016 15:13
Git Aliases
[alias]
# Merge the current branch to another one, created back when I needed to merge into three branches before issuing a PR
merge-to = "!f() { git checkout $1 && git merge $2 && git checkout $2; }; f"
# Commit shorthand family:
c = commit
cm = commit -m
cam = commit -am
camp = "!f() { git commit -am \"$1\"; git push; }; f"
ca = commit -a
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active July 17, 2024 09:19
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@olih
olih / jq-cheetsheet.md
Last active July 16, 2024 23:02
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq