Skip to content

Instantly share code, notes, and snippets.

View tmacharia's full-sized avatar
:octocat:
Focusing

Timothy Macharia tmacharia

:octocat:
Focusing
  • Nairobi, KE
View GitHub Profile
@tmacharia
tmacharia / ZoneExts.cs
Last active November 16, 2019 01:22
For achieving a high level of accuracy in detecting the location a machine/user in .NET/C# without location/gps permissions, this helper class contains a bunch of methods & properties to achieve using the machine's LocalTimeZone and looking it up against a known list of timezone info schema that maps to a country's 2-Letter ISO Code.
namespace Common
{
using System.Linq;
public class ZoneInfo
{
/// <summary>
/// 2-Letter ISO code representing the country where the timezone is.
/// </summary>
public string Code { get; set; }
/// <summary>
@JulianNorton
JulianNorton / uninstall-rippling.sh
Created August 13, 2018 22:31
uninstall rippling
#!/bin/bash
if [ `id -u` -ne 0 ]; then
echo "Rippling uninstall must be run by root"
exit 1
fi
sudo launchctl unload /Library/LaunchDaemons/com.rippling.*
sudo rm -rf /Library/LaunchDaemons/com.rippling.*
sudo rm -rf /opt/rippling
@christiannagel
christiannagel / _CookieConsentPartial.cshtml
Created May 24, 2018 10:26
Cookie Consent View Implementation - ASP.NET Core 2.1
@using Microsoft.AspNetCore.Http.Features
@{
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
var showBanner = !consentFeature?.CanTrack ?? false;
var cookieString = consentFeature?.CreateConsentCookie();
}
@if (showBanner)
{
@madskristensen
madskristensen / ETagMiddleware.cs
Last active September 11, 2024 18:38
ASP.NET Core ETAg middleware
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Net.Http.Headers;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
public class ETagMiddleware
{