Skip to content

Instantly share code, notes, and snippets.

View ChristopherHaws's full-sized avatar

Christopher Haws ChristopherHaws

  • Arvato Bertelsmann
  • Santa Clarita, CA, USA
  • 23:58 (UTC -07:00)
View GitHub Profile
@ChristopherHaws
ChristopherHaws / scan.sh
Created July 19, 2023 17:34
scan file for virus and move it if it is clean
#!/bin/bash
SRC_DIR="/source/directory/path"
DEST_DIR="/destination/directory/path"
LOG_FILE="/path/to/clamscan.log"
find "$SRC_DIR" -type f | xargs -I {} -P $(nproc) sh -c "
if clamscan -i --no-summary '{}'
then
rsync -avz --progress '{}' '$DEST_DIR'
@ChristopherHaws
ChristopherHaws / DisposingLoggerScopeFactory.cs
Last active April 16, 2021 12:21
DisposingLoggerScopeFactory
/// <summary>
/// Used to create logging scopes that will live for the lifetime of the service providers scope.
/// </summary>
public interface ILoggerScopeFactory
{
void BeginScope<TState>(TState state);
void BeginScope(String messageFormat, params Object[] args);
}
public class DisposingLoggerScopeFactory : ILoggerScopeFactory, IDisposable
@ChristopherHaws
ChristopherHaws / AsyncUtilities.cs
Last active August 6, 2023 15:31
EFCore Azure AccessToken
using System.Collections.Generic;
namespace System.Threading.Tasks
{
public static class AsyncUtilities
{
/// <summary>
/// Execute's an async Task{T} method which has a void return value synchronously
/// </summary>
/// <param name="task">Task{T} method to execute</param>
@ChristopherHaws
ChristopherHaws / ColumnEntity.cs
Created September 21, 2017 19:34
SqlSchemaModeler
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Data.SqlClient
{
public class ColumnEntity
{