Skip to content

Instantly share code, notes, and snippets.

Subject access request
I am writing to formally make a Subject Access Request, for a digital copy of information held about me, for which I am entitled to under the General Data Protection Regulations (GDPR) 2018.
You can identify my records by using the following information:
• Name: CHANGEME
• Address: CHANGEME
Please supply the data about me, that I am entitled to, under the Data Protection Act 2019, including:
• Confirmation that you are processing my personal data
@surgicalcoder
surgicalcoder / file.cs
Created August 10, 2020 12:30
Deterministic "random" number
void Main()
{
// 1000 = Minimum number
// 65536 = maximum number
(1000 + GetInt64HashCode("John Reginald III esq.") % 65536).Dump();
}
static Int64 GetInt64HashCode(string strText)
{
Int64 hashCode = 0;
@surgicalcoder
surgicalcoder / program.cs
Last active August 2, 2020 14:38
Lunr Code Example
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Lunr;
using Index = Lunr.Index;
namespace LunrCodeJsonExample
{
class Program
@surgicalcoder
surgicalcoder / docker-for-windows.md
Created May 26, 2020 10:06 — forked from BretFisher/docker-for-windows.md
Getting a Shell in the Docker for Windows Moby VM

2018 Update: Easiest option is Justin's repo and image

Just run this from your CLI and it'll drop you in a container with full permissions on the Moby VM. Only works for Moby Linux VM (doesn't work for Windows Containers). Note this also works on Docker for Mac.

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1

@surgicalcoder
surgicalcoder / CreateDapperPOCO.groovy
Last active February 1, 2024 08:28
Generate Dapper Contrib from database with DataGrip
import com.intellij.database.model.DasTable
import com.intellij.database.model.ObjectKind
import com.intellij.database.util.Case
import com.intellij.database.util.DasUtil
import com.intellij.database.model.DasIndex
import com.intellij.util.ObjectUtils
import groovy.json.*
typeMapping = [
(~/(?i)^bit$/) : "bool",
@surgicalcoder
surgicalcoder / file.cs
Last active August 16, 2017 12:39
JsonToParametersAttribute
public class JsonToParametersAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
base.OnActionExecuting(filterContext);
var stream = filterContext.HttpContext.Request.Body;
using (var sr = new StreamReader(stream))
using (var jsonTextReader = new JsonTextReader(sr))
{
@surgicalcoder
surgicalcoder / blarg.cs
Created March 20, 2017 14:49
Hack for adding MVC Core modules dynamically
public class Blarg : ApplicationPart, IApplicationPartTypeProvider, ICompilationReferencesProvider
{
public Assembly Assembly { get; }
public Blarg(Assembly assembly)
{
if (assembly == (Assembly)null)
throw new ArgumentNullException("assembly");
this.Assembly = assembly;
}
public override string Name
@surgicalcoder
surgicalcoder / file.cs
Created January 2, 2017 14:25
URL Friendly Base64'ness
public static class Base64Extension
{
static readonly char[] padding = { '=' };
public static string EncodeURLBase64(this string Input)
{
var base64 = Convert.ToBase64String(Encoding.Default.GetBytes(Input)).TrimEnd(padding).Replace('+', '-').Replace('/', '_');
return base64;
}
public static string DecodeURLBase64(this string Input)
@surgicalcoder
surgicalcoder / IPProtocolType.cs
Created July 25, 2016 11:23
C# IP Protocol Type Enum
public enum IPProtocolType
{
[Description("IPv6 Hop-by-Hop Option")]
HOPOPT = 0,
[Description("Internet Control Message")]
ICMP = 1,
[Description("Internet Group Management")]
IGMP = 2,
[Description("Gateway-to-Gateway")]
GGP = 3,
@surgicalcoder
surgicalcoder / Program.cs
Created December 25, 2015 21:03 — forked from DanielSWolf/Program.cs
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);