Skip to content

Instantly share code, notes, and snippets.

View lf-'s full-sized avatar
💭
GitHub 💧🧊

Jade Lovelace lf-

💭
GitHub 💧🧊
View GitHub Profile
@Innf107
Innf107 / comefrom.hs
Last active December 2, 2022 19:08
Haskell monadic COMEFROM
{-# LANGUAGE RankNTypes, PatternSynonyms, GADTs, ViewPatterns, LambdaCase, ScopedTypeVariables #-}
module Main where
import Data.Map as Map
import Control.Monad (ap, liftM)
import Data.IORef
data ComeFromOp a where
Line :: Int -> ComeFromOp ()
LiftIO :: IO () -> ComeFromOp ()
@LAK132
LAK132 / results.c
Last active December 5, 2023 12:57
Result types in C
#ifndef __cplusplus
# define decltype typeof
# include <stdbool.h>
#endif
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#define TOKEN_CONCAT_EX(x, y) x##y
#define TOKEN_CONCAT(x, y) TOKEN_CONCAT_EX(x, y)
@IanColdwater
IanColdwater / twittermute.txt
Last active May 23, 2024 18:37
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@fatcerberus
fatcerberus / monads4all.md
Last active February 24, 2024 07:58
Monads for the Rest of Us

Monads for the Rest of Us

by Bruce Pascoe - 1 May, 2019

"A monad is just a monoid in the category of endofunctors. What's the problem?" ~James Iry[^1]

The problem... is that there are several problems.

It's been said that monads bear a dreadful curse. Once you finally understand what they are, you begin to see them everywhere--but somehow become completely incapable of explaining them to anyone else. Many tutorial writers have tried to break the Great Curse--the Web is lousy with bold attempts and half successes that attest to this--and just as many have failed. Well, I'm here to address the elephant in the room[^2] and tell you that I intend to break the Great Curse once and for all.

There are basically two ways a monad tutorial tends to go. One is a paragraph or two of minimal descriptions of one or two common monads (Haskell's Maybe in particular is very popular), followed by a lot of intimidating Haskell syntax trying to explain--precisely--how it all fits together. This is well

@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@edolstra
edolstra / nix-lang.md
Last active June 10, 2024 09:17
Nix language changes

This document contains some ideas for additions to the Nix language.

Motivation

The Nix package manager, Nixpkgs and NixOS currently have several problems:

  • Poor discoverability of package options. Package functions have function arguments like enableFoo, but there is no way for the Nix UI to discover them, let alone to provide programmatic ways to
@lf-
lf- / leftpad.py
Last active October 7, 2021 05:41
leftpad.py
class left_pad:
def __init__(this,PadChar=' ',width=4):
this.PadChar=PadChar
this.width = width
def LeftPad(this,stringToPadWithChar):
charsToPad=this.width-len(stringToPadWithChar)
OutStr=''
if(charsToPad>0):
for i in range(0,charsToPad):
OutStr=OutStr+this.PadChar
@jhass
jhass / README.md
Last active May 7, 2024 07:11 — forked from yorkxin/README.md
Proxy to remote server with CORS support

cors.py for mitmproxy

Hacking CORS restriction to enable in-browser XHR to any server.

Usage

Say you are running an web app at localhost, and you want to send XHR to http://remote-server:80, but the CORS restriction forbids access because you are sending requests from an origin that remote-server:80 does not allow.

Run:

@tvogel
tvogel / git-merge-associate
Created March 30, 2011 13:23
git script to manually associate files in a conflicting merge when rename detection fails
#!/bin/bash
#
# Purpose: manually associate missed renames in merge conflicts
#
# Usage: git merge-associate <our-target> <base> <theirs>
#
# Example: After a failed rename detection A/a -> B/b which results
# in CONFLICT (delete/modify) for A/a and corresponding "deleted by us"
# messages in git status, the following invocation can be used to manually
# establish the link: