This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io" | |
"strings" | |
"golang.org/x/net/html" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# Get the last tag | |
last_tag=$(git describe --tags 2> /dev/null) | |
# If the last tag does not exist, get the commit hash of the last commit | |
if [ $? -ne 0 ]; then | |
last_tag="HEAD~1" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Prints the next version based on git tags in the pattern v0.0.0 | |
# Uses regexp to infer which part of the version will be incremented | |
# Inspired by https://gitversion.net/docs/reference/version-increments | |
MAJOR_REGEXP="\+semver:\s?(breaking|major)" | |
MINOR_REGEXP="\+semver:\s?(feature|minor)" | |
COMMIT_TAG=$(git describe --exact-match --tags HEAD 2>/dev/null || true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
./build || exit 1 && clear | |
wait_device() { | |
while lsusb -d $1; [ $? -ne 0 ]; do | |
echo $2; | |
sleep 1; | |
done | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CARD=$(pactl list | grep bluez_card | awk '{print $NF}') | |
BLUETOOTH_DEVICE=$(pacmd list-sinks | grep -o '<bluez_sink[^>]*' | cut -d\< -f2) | |
PROFILE_A2DP="a2dp_sink" | |
PROFILE_HEADSET_UNIT="headset_head_unit" | |
if [ "${1}" == "" -o "${1}" == "toggle" ] ; then | |
if $(pacmd list-sinks | grep -o "<bluez_sink\..*\.$PROFILE_A2DP>" &> /dev/null) ; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc.Formatters; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.Net.Http.Headers; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Threading.Tasks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async Task ProcessMultipleAtOnce<T>(int maxDegreeOfParallelism, IEnumerable<T> items, Func<T, Task> func) | |
{ | |
var actionBlock = new ActionBlock<T>(func, new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = maxDegreeOfParallelism }); | |
foreach (T item in items) | |
{ | |
await actionBlock.SendAsync(item); | |
} | |
actionBlock.Complete(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from https://weblogs.asp.net/ricardoperes/integrating-managed-extensibility-framework-with-the-net-service-provider | |
// Other interesting links: | |
// https://weblogs.asp.net/ricardoperes/dynamically-loading-middleware-in-asp-net-core | |
// https://weblogs.asp.net/ricardoperes/using-mef-in-net-core | |
public static class ContainerConfigurationExtensions | |
{ | |
public static ContainerConfiguration WithAssembliesInPath(this ContainerConfiguration configuration, string path, SearchOption searchOption = SearchOption.TopDirectoryOnly) | |
{ | |
return WithAssembliesInPath(configuration, path, null, searchOption); |