Skip to content

Instantly share code, notes, and snippets.

View sar's full-sized avatar

Sar Malik sar

View GitHub Profile
@sar
sar / 20-nvidia.conf
Created April 21, 2021 00:26
Base X11 nvidia config for NixOS
# -------------------------
# NVIDIA X11 Config
# path: /etc/X11/xorg.conf.d/10-nvidia.conf
# -------------------------
Section "OutputClass"
Identifier "nvidia"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "AllowExternalGpus" "True"
public class IdentifierMasking
{
private static byte[] _key;
public IdentifierMasking(byte[] key = null)
{
_key = key ?? Sodium.SecretBox.GenerateKey();
}
public string RevealIdentifier(string hidden)
using System.IdentityModel.Tokens.Jwt;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Protocols;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using Microsoft.IdentityModel.Tokens;
namespace authproxy
{
public class TokenValidator
/*---------------------------------------------------------------------------------------------
* Copyright (c) Dolittle. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text.Encodings.Web;
@sar
sar / startup.cs
Last active April 1, 2021 22:07
CookieAuthenticationScheme defaults
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
}
.AddCookie();
}
@sar
sar / typescript-decorators.md
Created March 22, 2021 04:35
Quick guide on constructing TypeScript @decorators

TypeScript Decorators

Wrapping typeof React.Component || React.ComponentType

function UsefulDecorator<T extends new (...args) => any>(
    BaseClass: T,
): T {
    return class _usefulClass extends BaseClass {
 private _someStore: typeof SomeStore = SomeStore;
@sar
sar / xorg.conf.egpu
Last active March 18, 2021 17:58
cat /etc/X11/xorg.conf.egpu
# ----------
# EGPU as Default Config for X11
# Place under (ln -s) /etc/X11/xorg.conf -> /etc/X11/xorg.conf.egpu
# Replace busId using lspci -vvv | grep NVIDIA
# ----------
Section "Module"
Load "modesetting"
EndSection
@sar
sar / 10-nvidia.conf
Created March 18, 2021 17:54
cat /etc/X11/xorg.conf.d/10-nvidia.conf
# -------------------------
# NVIDIA X11 Config
# path: /etc/X11/xorg.conf.d/10-nvidia.conf
# -------------------------
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
@sar
sar / page_curl.sh
Created March 14, 2021 00:48
cURL webpage n-loops for Chaos Testing, DDoS, and Analytics Spiking
#!/bin/bash
# ----------------------
# cURL webpage n-iters useful for Chaos Testing, DDoS, Analytics Spiking
# Author github@sar assumes no responsibility for your actions
# ----------------------
read -p "Enter direct URL for cURL page loop: " url
read -p "Max loop iterations: " iter
counter=1
@sar
sar / firefox.webgpu.md
Created March 14, 2021 00:44
Enable Web GPU Video Decoding and DOM Acceleration on Firefox Linux

Firefox GPU Acceleration

Enable GPU accelerated content decoding and DOM compositor rendering on Linux. For more details refer to docs.

Properties can be set by navigating to about:config.

DOM

gfx.webrender.all=true
layers.mlgpu.enabled=true