Skip to content

Instantly share code, notes, and snippets.

View fernando-almeida's full-sized avatar

Fernando Almeida fernando-almeida

  • Viseu, Portugal
View GitHub Profile
@fernando-almeida
fernando-almeida / Program.cs
Created November 18, 2022 16:01
Extract Links From Google Document
using System.Collections.Generic;
using Google.Apis.Docs;
using Google.Apis.Docs.v1;
using Google.Apis.Docs.v1.Data;
using System.Data.Common;
using System.Xml.Linq;
using Newtonsoft.Json;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Util.Store;
/// <summary>
/// Rewrite URL API version segment if it exists
/// </summary>
public class UrlSegmentApiVersionStripMiddleware {
private static readonly string DEFAULT_API_VERSION_PREFIX = "v";
private readonly string _apiVersionVersion;
private readonly RequestDelegate _next;
@fernando-almeida
fernando-almeida / docker_rm_container_of_image.sh
Created February 8, 2018 12:31
Remove Docker container matching a given image name
#!/bin/bash
for docker_image_name in "$@"
do
container_ids=$(docker ps -a | awk '{ print $1,$2 }' | grep $docker_image_name | awk '{print $1 }')
if [ ! -z $container_ids ]
then
echo $container_ids | xargs -I {} docker rm -f {}
else
echo "No containers found for image \"$docker_image_name\"."