Skip to content

Instantly share code, notes, and snippets.

@mikaelvesavuori
mikaelvesavuori / AuthController.ts
Created July 5, 2021 11:11
Using Lambda authorizers in Serverless Framework
import { APIGatewayProxyResult } from 'aws-lambda';
/**
* @description The controller.
*/
export async function handler(event: any): Promise<APIGatewayProxyResult> {
const clientToken = event.authorizationToken || event.headers.Authorization; // Do something with an incoming auth token
const active = true; // Do something to check if user is active or similar
@fnky
fnky / ANSI.md
Last active May 8, 2024 01:48
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
/*
A simple little editor extension to copy and paste all components
Help from http://answers.unity3d.com/questions/541045/copy-all-components-from-one-character-to-another.html
license: WTFPL (http://www.wtfpl.net/)
author: aeroson
advise: ChessMax
editor: frekons
*/
#if UNITY_EDITOR
@Refsa
Refsa / URPSimpleLit.shader
Created October 31, 2020 09:03
Unity - Shader showing how to write a Simple Lit shader for Unity URP
Shader "Custom/URPSimpleLit"
{
Properties
{
_Color ("Color", Color) = (1,0,0,1)
}
SubShader
{
Tags {
"RenderPipeline" = "UniversalPipeline"
BLACK => "\033[30m",
RED => "\033[31m",
GREEN => "\033[32m",
YELLOW => "\033[33m",
BLUE => "\033[34m",
PURPLE => "\033[35m",
CYAN => "\033[36m",
WHITE => "\033[37m",
# background color
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active May 8, 2024 01:34
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@benkoshy
benkoshy / viewDirectionObtainer.md
Created January 11, 2019 09:52
View Direction Obtainer (AutoCAD .net Sample code - Focusing Mainly on the LineDirectionJigger
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;

namespace BKTools.Tools.PrecastTools.LayoutsToElevationsCommand
{
    /// <summary>
    /// We want panel lines that are perpendicular to the rotation of a particular block reference
    /// </summary>
@Akhil-Suresh
Akhil-Suresh / postman_installation.md
Last active May 8, 2024 01:31
Installing Postman on Ubuntu/Debian

Installing Postman

Step 1

If any version of postman is installed we need to remove it

sudo rm -rf /opt/Postman

Step 2

@projectoperations
projectoperations / docker-api-port.md
Created May 4, 2024 20:17 — forked from styblope/docker-api-port.md
Enable TCP port 2375 for external connection to Docker

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
    
@Twanne
Twanne / multi_click_button.yaml
Last active May 8, 2024 01:34
Home Assistant Blueprint: Multi Click Button
blueprint:
name: Multi Click Button
author: AntonH
description: |
**Version 1.1**
Allows multi-click actions to take place on a button.
Upon reaching the number of required clicks, it executes user defined actions.
There are 3 entity types supported:
- button