Skip to content

Instantly share code, notes, and snippets.

@Fang-
Fang- / mirage.md
Last active October 5, 2023 23:47
Mirage (EAuth)

mirage (eauth)

Urbit's identity layer pervades everything on Mars. Unfortunately, despite talking to Mars a lot, Earth is not quite so fortunate. A notable example are requests made to Urbit's HTTP server, Eyre. Presently, when viewing for example a blog post hosted by someone else's urbit, there is no way for a user to leave a comment signed by their own identity right then and there: they need to go through their own urbit instead, maybe even installing a matching blog app.

@emeraldsanto
emeraldsanto / async-batch.ts
Created February 26, 2022 17:39
Utility function to sequentially run batches of async operations with configurable concurrency.
/**
* Allows for sequentially running batches of async operations.
* @param {number} concurrency The maximum number of operations to run concurrently.
*/
export function batch(concurrency: number) {
return async function <TElement, TResult>(xs: Array<TElement>, handler: (x: TElement) => TResult): Promise<Array<TResult>> {
const results: Array<TResult> = [];
const batches = Array.from({ length: Math.ceil(xs.length / concurrency) }, (_, i) => i)
for await (const batchNumber of batches) {
@SwitHak
SwitHak / 20211210-TLP-WHITE_LOG4J.md
Last active May 6, 2024 10:09
BlueTeam CheatSheet * Log4Shell* | Last updated: 2021-12-20 2238 UTC

Security Advisories / Bulletins / vendors Responses linked to Log4Shell (CVE-2021-44228)

Errors, typos, something to say ?

  • If you want to add a link, comment or send it to me
  • Feel free to report any mistake directly below in the comment or in DM on Twitter @SwitHak

Other great resources

  • Royce Williams list sorted by vendors responses Royce List
  • Very detailed list NCSC-NL
  • The list maintained by U.S. Cybersecurity and Infrastructure Security Agency: CISA List
@nikhiljha
nikhiljha / README.md
Last active February 10, 2024 22:34
Apple Silicon (M1) + MultiMC + Minecraft 1.18 + Native LWJGL

Apple Silicon (M1) + MultiMC + Minecraft 1.18 + Native LWJGL

Up to Minecraft 1.17.X I used yusefnapora/m1-multimc-hack, but this stopped working for me starting in Minecraft 1.18. Grabbing random jarfiles from a git repository is a little suspicious, so let's do it safely by getting the libraries from the official LWJGL website!

Installing Java

If you don't have Homebrew installed already, install Homebrew by following the instructions at brew.sh. Then, just open a Terminal and type...

brew install java

Minecraft on Apple Silicon (v2 - 1.17 & Microsoft authentication)

In this gist, you can find the steps to run Minecraft 1.17 natively on Apple Silicon (AS), without needing Rosetta 2 translation of the dependencies (mainly LWJGL and related libraries).

While it's possible to use a launcher like MultiMC to have a prettier way to run the game on AS, it requires installing even more dependencies (like QT) which take time and are difficult to distribute. Therefore, I've put together a command line-based launcher tool using a couple shell & Python scripts.

To get up and running quickly, follow the steps below. Otherwise, for more detail, watch my YouTube videos: old, new.

Download my package

@tannerlinsley
tannerlinsley / README.md
Last active April 12, 2024 17:04
Replacing Create React App with the Next.js CLI

Replacing Create React App with the Next.js CLI

How dare you make a jab at Create React App!?

Firstly, Create React App is good. But it's a very rigid CLI, primarily designed for projects that require very little to no configuration. This makes it great for beginners and simple projects but unfortunately, this means that it's pretty non-extensible. Despite the involvement from big names and a ton of great devs, it has left me wanting a much better developer experience with a lot more polish when it comes to hot reloading, babel configuration, webpack configuration, etc. It's definitely simple and good, but not amazing.

Now, compare that experience to Next.js which for starters has a much larger team behind it provided by a world-class company (Vercel) who are all financially dedicated to making it the best DX you could imagine to build any React application. Next.js is the 💣-diggity. It has amazing docs, great support, can grow with your requirements into SSR or static site generation, etc.

So why

@oseme-techguy
oseme-techguy / Correct_GnuPG_Permission.sh
Last active April 28, 2024 04:37
This fixes the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error while using Gnupg .
#!/usr/bin/env bash
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) ~/.gnupg/
# Also correct the permissions and access rights on the directory
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
@bjornjohansen
bjornjohansen / wordpress-menu-cache.php
Last active March 7, 2024 13:57
WordPress Menu Cache
<?php
/**
* WordPress menu cache.
*
* @package BJ\Menu
* @author bjornjohansen
* @version 0.1.0
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License version 2 (GPLv2)
*/
#!/bin/bash
# CACHE WARMER script for XML Sitemaps with MULTIPLE SUB-SITEMAPS:
DOMAIN='https://www.xyz.com'
wget -q $DOMAIN/sitemap.xml --no-cache -O - | egrep -o "$DOMAIN[^<]+" | while read subsite;
do
echo --- Reading sub-sitemap: $subsite: ---
wget -q $subsite --no-cache -O - | egrep -o "$DOMAIN[^<]+" | while read line;
do
echo $line:
time curl -A 'Cache Warmer' -s -L $line > /dev/null 2>&1
@pyohei
pyohei / iTunesMusicCopy.sh
Last active February 16, 2020 22:55
Copy iTunes Music into iCloud drive directory.
#!/bin/sh
#
# Copy iTunes Music data into iCloud drive.
# This script placed on https://gist.github.com/pyohei/2a5fe506be29e07b89428198268be4dc
# If you modify, you reflect it on the upper gist!!
#
# Licence: MIT
ICLOUD_DIR="/Users/${USER}/Library/Mobile Documents/com~apple~CloudDocs"