Skip to content

Instantly share code, notes, and snippets.

View oof2win2's full-sized avatar
🐛

oof2win2 oof2win2

🐛
  • Czech Republic
  • 07:54 (UTC +02:00)
View GitHub Profile
@blanchardjeremy
blanchardjeremy / README.md
Last active January 16, 2022 10:16
Workflow: Using a GitHub application to edit files, and auto-merge them

Workflow: Using a GitHub application to edit files, and auto-merge them

This gist offers a pattern to create a GitHub application (aka: bot) that serves as a bot to edit files and succesfully merge them into your repo, using GitHub actions & workflow files.

The end result is that you can have workflows that look like this:

image

Instead of this:

@tatupesonen
tatupesonen / merge.js
Last active January 11, 2022 09:02
Object specific merge
const util = require("util");
const { performance } = require("perf_hooks");
// Input data is like this
const exampleInput = [
{ 9668: { "Fa0/11": { in_traffic: "1000" } } },
{ 9668: { "Fa0/11": { out_traffic: "900" } } },
{ 9628: { "Fa0/16": { in_traffic: "800" } } },
];
@samsch
samsch / stop-using-jwts.md
Last active May 26, 2024 19:07
Stop using JWTs

Stop using JWTs!

TLDR: JWTs should not be used for keeping your user logged in. They are not designed for this purpose, they are not secure, and there is a much better tool which is designed for it: regular cookie sessions.

If you've got a bit of time to watch a presentation on it, I highly recommend this talk: https://www.youtube.com/watch?v=pYeekwv3vC4 (Note that other topics are largely skimmed over, such as CSRF protection. You should learn about other topics from other sources. Also note that "valid" usecases for JWTs at the end of the video can also be easily handled by other, better, and more secure tools. Specifically, PASETO.)

A related topic: Don't use localStorage (or sessionStorage) for authentication credentials, including JWT tokens: https://www.rdegges.com/2018/please-stop-using-local-storage/

The reason to avoid JWTs comes down to a couple different points:

  • The JWT specification is specifically designed only for very short-live tokens (~5 minute or less). Sessions
@joseluisq
joseluisq / stash_dropped.md
Last active June 13, 2024 15:13
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.