Skip to content

Instantly share code, notes, and snippets.

View johnnypea's full-sized avatar
🏠
Working from home

Ján Bočínec johnnypea

🏠
Working from home
View GitHub Profile
@tomlarkworthy
tomlarkworthy / isomorphic-git-cors-proxy.js
Last active June 15, 2025 08:15
isomorphic git proxy on Cloudflare Workers
addEventListener('fetch', e => e.respondWith(handle(e.request)))
const ok = (req,u)=>{
const q=u.searchParams
return req.method==='OPTIONS'||
(req.method==='GET' && u.pathname.endsWith('/info/refs') &&
['git-upload-pack','git-receive-pack'].includes(q.get('service')))||
(req.method==='POST'&&u.pathname.endsWith('git-upload-pack') &&
req.headers.get('content-type')==='application/x-git-upload-pack-request')||
(req.method==='POST'&&u.pathname.endsWith('git-receive-pack') &&
@joperezr
joperezr / Auth.md
Last active July 29, 2025 18:20
Authentication & Authorization in ASP.NET Core

Deep Dive into ASP.NET Core Authentication, Authorization, and Identity

Authentication vs. Authorization vs. Identity

Authentication is the act of verifying who a user is. When a user successfully authenticates (for example, by entering the correct credentials or token), the application establishes the user’s identity (often represented by a ClaimsPrincipal in ASP.NET Core) (Introduction to authorization in ASP.NET Core | Microsoft Learn). In other words, authentication answers “Who are you?” and results in an identity that the app can use. By contrast, Authorization is about what the authenticated user is allowed to do or access. It answers “What are you allowed to do?” ([Introduction to authorization in ASP.NET Core | Microsoft Learn](https://learn.microsoft.com/en-us/aspnet/core/securit

@mdbraber
mdbraber / save-safari-pdf.swift
Last active July 22, 2025 13:50
Save Safari website as PDF (with syncing cookies)
#!/usr/bin/swift
@preconcurrency import WebKit
@preconcurrency import Foundation
@preconcurrency import Darwin
// Disable everything written to stderr
freopen("/dev/null", "w", stderr)
struct Cookie {
@ttscoff
ttscoff / pullremote.sh
Last active February 3, 2025 19:53
remote git pull script
#!/bin/bash
# Remote host is the first argument
HOST=$1
# Remote directory is a mirror of the local directory
DIR=$(pwd)
# SSH to the host and run the pull script
ssh $HOST "~/scripts/remotepull.sh '$DIR'"
# Sync Build notes not stored in git
@mikeslattery
mikeslattery / .idea-lazy.vim
Last active July 17, 2025 02:58
LazyVim mappings for Jetbrains IDEs
" ~/.idea-lazy.vim
" LazyVim mappings for Jetbrains IDEs
" Required plugins. https://plugins.jetbrains.com/bundles/7-ideavim-bundle
" IDEAVim
" Which-Key
" IdeaVim-Sneak
" To install, add this to the top of your ~/.ideavimrc:
@cajuncoding
cajuncoding / SystemTextJsonNodeMergeExtensions.cs
Last active July 31, 2025 14:12
Simple Merge process for JsonNode using System.Text.Json
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;
namespace CajunCoding
{
public static class SystemTextJsonMergeExtensions
{
@kennypete
kennypete / navigating_the_modes_of_Vim.md
Created April 18, 2024 20:46
Navigating the modes of Vim

Navigating the modes of Vim

This diagram illustrates navigating through Vim’s modes. It was built factoring Vim 9 (i.e., all its modes, including up to two new modes, cr and cvr, in November 2023). Information about the state() and 'showmode' is provided too.

SVG version

Some features are only available in the SVG version. It is not provided directly from within this gist’s files because SVGs do not always play nicely in GitHub (particularly, refusing to display embedded fonts).

The SVG version includes hover text help, which shows pertinent information about the underlying key, command, mode, etc.

@radermacher
radermacher / boost.js
Last active August 28, 2023 10:55 — forked from b-nnett/boost.js
Arc ChatGPT Boost
// fork of https://gist.github.com/b-nnett/2749adb44566239e4c85ad1a8937c2bc
// origin by @B_nnett → https://twitter.com/joshm/status/1648346253355282432?s=20
/*
To set up this boost for chat.openai.com:
1) open Arc browser and login at chat.openai.com.
2) Head over to the + button in your sidebar and select New Boost.
Or hit ⌘ + T and type New Boost into your Command Bar.
3) Click the `Code` button.
@ttscoff
ttscoff / lexers.rb
Last active June 6, 2023 21:54
Find the perfect lexer to highlight your fenced code blocks and other fancy stuff. If you know the common name of a language or a common file extension for it, this script will tell you exactly what most syntax highlighters will recoghize.
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'optparse'
# Have you ever been adding code to a Markdown post and
# wondered what syntax label would give you the right
# highlighting for your fenced code block? This script can
# take either a file extension or a common name of a language
# and let you know what lexers are supported for it, as well
@barvian
barvian / index.svelte
Last active January 23, 2023 17:36
Vite plugin for SvelteKit
<script context="module" lang="ts">
import type * as $types from './$types'
export const csr = false
export const getData = (async (event) => {
return {
server: event.data.server,
client: 'client data!'
}