Skip to content

Instantly share code, notes, and snippets.

@deeja
deeja / amplify_shim.graphql
Last active November 29, 2023 00:07
Amplify GraphQL -> C# Code Generation using `graphql-codegen`
# Taken from https://github.com/dotansimha/graphql-code-generator/discussions/4311
scalar AWSTime
scalar AWSDate
scalar AWSDateTime
scalar AWSTimestamp
scalar AWSEmail
scalar AWSJSON
scalar AWSURL
scalar AWSPhone
@deeja
deeja / network-manager-raspbian-2020-02-05.md
Created April 21, 2022 07:26 — forked from jjsanderson/network-manager-raspbian-2020-02-05.md
Installing Network Manager on Raspbian 2020-02-05

Installing Network Manager on Raspbian 2020-02-05

NOTE:
This guide was written two years ago, which in Pi years means it's now graduated college, or something. Inevitably, it's at least a little out of date, and it may even be entirely misleading. There are several helpful suggestions in the comments (thanks everyone), and most recently a report that what's here plain doesn't work on current (early 2022) Raspbian. Which isn't even called 'Raspbian' any more.
As of Jan 2022 I'm partially back in my office-which-has-access-to-eduroam, and I do have a need to build up a fresh Pi desktop. If and when I get that working I'll update this guide. In the meantime: good luck, and please leave a comment to report success or failure.

Default Raspbian is not able to connect to wifi networks using corporate security setups, including eduroam. However, the issue is that the packaged networking control widget does not expose the relevant security features, rather than any underlying hardware limitation. The sol

@deeja
deeja / CreateElasticSearchDataStreamTest.cs
Last active March 30, 2021 16:46
Create a data stream index template using NEST for Elastic Search
using System;
using Elasticsearch.Net;
using Nest;
using NUnit.Framework;
public class CreateDataStreamTest
{
[Test]
public void ShouldCreateDataStreamTemplate()
{
@deeja
deeja / Program.cs
Created March 22, 2021 18:20
Kestrel self hosting .net core 3.1
private static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.UseKestrel((context, options) =>
{
@deeja
deeja / .gitConfig
Created February 4, 2021 10:49
Conditional Git Configuration on Windows
# Config in MY_WORK_DIRECTORY
[user]
name = "Work user"
email = [email protected]
@deeja
deeja / logger.cs
Created November 16, 2020 09:58
Microsoft ILogger to Windsor ILogger and Factory
public class ThisLogger: ILoggerFactory
{
private readonly Microsoft.Extensions.Logging.ILoggerFactory _logger;
public ThisLogger(Microsoft.Extensions.Logging.ILoggerFactory logger)
{
_logger = logger;
}
public ILogger Create(Type type)
@deeja
deeja / AddVisualStudioCodeShortCuts.reg
Created October 7, 2020 16:04
VSCode Context menu - Adds Visual Studio Code (VsCode) to the right click context menu in File Explorer (Change YOUR_USER_NAME)
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Users\\YOUR_USER_NAME\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Users\\YOUR_USER_NAME\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%1\""
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@deeja
deeja / FirebaseVuexPlugin.js
Created July 13, 2020 13:19
Nuxt Firebase "@nuxtjs/firebase" plug in alternative for vuex that returns the JWT token and sets in Vuex
// Using the "@nuxtjs/firebase" module
import {mutationNames} from '@/data/StoreNames'
export default async ({ store, app }, inject) => {
// Sets up a listener, mutations and action for every onAuthStateChanged by Firebase.
// AND runs the functions once BEFORE the root Vue.js Application is instantiated.
const unsubscribe = await new Promise(resolve => {
const unsubscribe = app.$fireAuth.onAuthStateChanged(async user => {
@deeja
deeja / FirebaseCertificateManager.cs
Last active October 4, 2024 09:41
Validating a Firebase JWT with .Net Core and SignalR (without .Net FirebaseAdmin)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
@deeja
deeja / OneClient-NoPacketsReceived
Created June 23, 2020 13:40
Examples of UdpClient not working
using System;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace ForzaData.UdpClient
{
internal class Program
{
private const int FORZA_DATA_OUT_PORT = 5300;