Skip to content

Instantly share code, notes, and snippets.

View CalvinAllen's full-sized avatar

Calvin A. Allen CalvinAllen

View GitHub Profile
javascript: (function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
return clipboardData.setData("Text", text);
} else if (
document.queryCommandSupported &&
document.queryCommandSupported("copy")
) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
{% assign cover_image = post.path | prepend: '/' | prepend: site.source %}
{% capture cover_image_exists %}{% cover_exists {{ cover_image }} %}{% endcapture %}
{% if post.image and cover_image_exists == "true" %}
<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="{{ site.url }}{{ post.url }}{{ post.image }}" />
{% else %}
<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="{{ site.url }}/images/social/headshot.jpg" />
{% endif %}
{% assign cover_image = page.path | prepend: '/' | prepend: site.source %}
{% capture cover_image_exists %}{% cover_exists {{ cover_image }} %}{% endcapture %}
{% if page.image and cover_image_exists == "true" %}
<meta property="og:image" content="{{ site.url }}{{ page.url }}{{ page.image }}" />
{% else %}
<meta property="og:image" content="{{ site.url }}/images/social/headshot.jpg" />
{% endif %}
Starting: UseDotNet
==============================================================================
Task : Use .NET Core
Description : Acquires a specific version of the .NET Core SDK from the internet or the local cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks. Additionally provides proxy support.
Version : 2.164.0
Author : Microsoft Corporation
Help : https://aka.ms/AA4xgy0
==============================================================================
Tool to install: .NET Core sdk version 3.1.x.
Found version 3.1.102 in channel 3.1 for user specified version spec: 3.1.x
@CalvinAllen
CalvinAllen / dotnet-framework-build-action.yml
Last active April 1, 2024 11:40
A GitHub Action to build a .NET Framework Web Application and Deploy it to Azure
name: EZRep Build
on:
push:
branches: master
jobs:
build:
runs-on: windows-latest
name: EZRep Build
on:
push:
tags: releases/[1-9]+.[0-9]+.[0-9]+
branches: master
jobs:
build:
runs-on: windows-latest
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<AWSProjectType>Lambda</AWSProjectType>
<AssemblyName>bootstrap</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.CloudWatchLogsEvents" Version="2.0.0" />
@CalvinAllen
CalvinAllen / script.sh
Created November 10, 2020 19:03 — forked from vielhuber/script.sh
PostgreSQL: Backup and restore pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
@CalvinAllen
CalvinAllen / Configuration.cs
Created February 16, 2022 22:14
Using ConfigurationBuilder
var configBuilder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile($"appsettings.{environment}.json", optional: true);
if (environment == EnvironmentEnum.LocalDevelopment)
{
configBuilder.AddUserSecrets<Function>(optional: true);
}
configBuilder.AddEnvironmentVariables();
@CalvinAllen
CalvinAllen / pre-commit
Created March 12, 2022 03:04 — forked from simonauner/pre-commit
Format c# with dotnet-format with pre-commit hook
#!/bin/sh
# Modified from https://gist.github.com/EtherZa/581d9276336353838b2c939f9554d479
#
# This script finds the files that are about to be committed,
# and runs dotnet format on them before adding them back to staging
#
# install dotnet-format: dotnet tool install -g dotnet-format
# make sure installed dotnet tools are on your path:
# export PATH="$PATH:$HOME/.dotnet/tools/"
# copy to .git/hooks/pre-commit and make executable