Skip to content

Instantly share code, notes, and snippets.

@kfox
kfox / README.md
Last active December 4, 2023 11:08
TCP echo server for Node.js

TCP echo server for Node.js

Usage

  1. Make sure you have a modern-ish version of Node.js installed.
  2. Type npx https://gist.github.com/kfox/1280c2f0ee8324067dba15300e0f2fd3
  3. Connect to it from a client, e.g. netcat or similar: nc localhost 9000
@casouri
casouri / eglot-rust-analyzer.el
Last active November 25, 2023 06:57
Configuring eglot for rust-analyzer
;; How to translate LSP configuration examples into Eglot’s format:
;;
;; Usually LSP servers will say something like
;;
;; rust-analyzer.procMacro.attributes.enable (default: true)
;;
;; Translate that into a JSON LSP configuration, you get
;;
;; {
;; "rust-analyzer": {

OpenSuSE MicroOS Linux - Unlock PIN Yubikey BIO FIDO USB Key

If your FIDO Key gots locked, because the fingerprint was not OK, then its quite easy to unlock the Yubikey FIDO BIO USB Key (if you know it!)

For me, only reset was possible over GUI with yubikey-manager, so the unlock requires shell command!

Install the yubikey-manager package:

@Kranzes
Kranzes / guide.md
Last active March 28, 2024 00:59
SSH Resident Key Guide

Initial checks

Start by checking that there aren't any previous ssh keys inside the FIDO2 authenticator of your YubiKey. You can check if they exist by running the command below:

nix shell nixpkgs#yubikey-manager -c ykman fido credentials list

If the command above outputs a string mentioning "ssh" or "openssh", then you have already got a key generated and store on your YubiKey.

Evaluating additional authentication factors

Before generating a new ssh key to store on your YubiKey you must consider which additional required authentication factors you want to use. Below you can see a table with the available factors and their corresponding command:

@mastoj
mastoj / solver.fsx
Created January 11, 2022 21:04
Naive wordle solver in F#
let candidates = """ACRID AIDER AIRED ARDRI AROID BIDER BIRDS BRAID BREID BRIDE CAIRD CARDI CIDER CRIED DAIRY DARIC DARIS DARZI DEAIR DERIG DIARY DICER DIKER DIMER DINAR DINER DIRAM DIRER DIRGE DIRKE DIRKS DIRLS DIRTS DIRTY DIVER DORIC DORIS DRAIL DRAIN DRIBS DRICE DRIED DRIER DRIES DRIFT DRILL DRILY DRINK DRIPS DRIPT DRIVE DROID DROIL DROIT DRUID DURZI EIDER FIORD FIRED FRIED GIRDS GRIDE GRIDS GRIND HIDER HIRED IDLER INDRI IRADE IRIDS IRKED IZARD JERID JIRDS LAIRD LIARD LIDAR LURID MARID MIRED MUDIR MURID NADIR NIDOR PADRI PARDI PRIDE PRIED RABID RADII RADIO RADIX RAIDS RAIRD RANID RAPID REBID REDIA REDID REDIP REIRD RESID RICED RIDER RIDES RIDGE RIDGY RIGID RILED RIMED RINDS RINDY RIPED RIVED RORID RUDIE SIDER SIRED THIRD THRID TIRED TRIAD TRIDE TRIED TRILD UNRID URSID VIRED VIRID WEIRD WIDER WIRED WRIED YAIRD YIRDS YRIVD"""
let wordList = candidates.Split(" ") |> List.ofArray
let fixedLetters = [(2, 'I')] |> Map.ofList
let excludedCharacters = "WE"
let includeLetters = [('R', [3]);('D',[4])] |> List.map
@didibus
didibus / clojure-right-tool.md
Last active January 15, 2024 11:23
When is Clojure "the right tool for the job"?

My answer to: https://www.reddit.com/r/Clojure/comments/pcwypb/us_engineers_love_to_say_the_right_tool_for_the/ which asked to know when and at what is Clojure "the right tool for the job"?

My take is that in general, the right tool for the job actually doesn't matter that much when it comes to programming language.

There are only a few cases where the options of tools that can do a sufficiently good job at the task become limited.

That's why they are called: General-purpose programming languages, because they can be used generally for most use cases without issues.

Let's look at some of the dimensions that make a difference and what I think of Clojure for them:

@geirsagberg
geirsagberg / tfsa.ts
Created April 20, 2021 12:04
Deno script for impersonating STM SA
#!/usr/bin/env -S deno run --allow-net --allow-read --allow-run
let tfVars: string;
try {
tfVars = Deno.readTextFileSync("./environments/STM.tfvars");
} catch (error) {
console.error(error);
Deno.exit(1);
}
@torgeir
torgeir / zoom-mute-status-setup.md
Last active October 13, 2022 21:21
Example configurations for AnyBar and Ubsersicht to get a visual cue representing your zoom mute status. Credits https://gist.github.com/tyhawkins/66d6f6ca8b3cb30c268df76d83020a64
@lancethomps
lancethomps / close_notifications_applescript.js
Last active March 7, 2024 03:56
AppleScript to close all notifications on macOS Big Sur, Monterey, and Ventura
function run(input, parameters) {
const appNames = [];
const skipAppNames = [];
const verbose = true;
const scriptName = "close_notifications_applescript";
const CLEAR_ALL_ACTION = "Clear All";
const CLEAR_ALL_ACTION_TOP = "Clear";
@jakewitcher
jakewitcher / upload_download_zip_from_gcp_cloud_storage.py
Last active October 5, 2023 13:52
uploading and downloading zip files to gcp cloud storage using python
import io
import os
import pathlib
from dotenv import load_dotenv
from google.cloud import storage
from google.oauth2 import service_account
from zipfile import ZipFile, ZipInfo