Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View PiDelport's full-sized avatar
💜
𝝺 🦀️ 🐍️ ☕️ 🏳️‍🌈️ 🏳️‍⚧️

Pi Delport PiDelport

💜
𝝺 🦀️ 🐍️ ☕️ 🏳️‍🌈️ 🏳️‍⚧️
View GitHub Profile
@PiDelport
PiDelport / gitlab-draft-comments.user.js
Last active October 21, 2023 07:43
GitLab Draft Comments (User Script)
// ==UserScript==
// @name GitLab Draft Comments
// @description Alert for and list forgotten GitLab draft comments.
// @namespace https://github.com/PiDelport/
// @author Pi Delport <pjdelport@gmail.com>
// @version 1.0
// @license MIT
// @homepageURL https://gist.github.com/PiDelport/74453fa91872a9e51c7858550ff3cab3
//
// @grant GM.registerMenuCommand
@PiDelport
PiDelport / slack-web-workspace-sidebar.user.js
Last active December 28, 2022 18:06
Slack Web Workspace Sidebar
// ==UserScript==
// @name Slack Web Workspace Sidebar
// @description Enable the workspace sidebar on the web version of Slack.
// @namespace https://github.com/PiDelport/
// @author Pi Delport <pjdelport@gmail.com>
// @version 1.0
// @license MIT
// @homepageURL https://gist.github.com/PiDelport/513676916e8fc186a09edfc8965a410b
// @match https://app.slack.com/*
// ==/UserScript==
@PiDelport
PiDelport / ssh_known_hosts
Last active March 27, 2023 17:24
SSH: Well-known host keys
# Well-known hosts
# https://gist.github.com/PiDelport/8a327a46c4453941bedfea5e8269f980
# https://blog.bitbucket.org/2018/07/02/new-ip-addresses-bitbucket-cloud/
bitbucket.org,18.205.93.0/25,13.52.5.0/25 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==
# GitHub
# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-githubs-ip-addresses
-- Sequence a list of Either-yielding monadic actions.
-- Sequencing stops on the first Left value, or yields a list successful Right values.
sequenceRights :: Monad m => [m (Either e t)] -> m (Either e [t])
sequenceRights [] = pure (pure [])
sequenceRights (x:xs) = handle =<< x
where
handle (Left e) = pure (Left e)
handle (Right t) = (t:) <<$>> sequenceRights xs
@PiDelport
PiDelport / Chain.hs
Last active August 29, 2015 14:05 — forked from mrb/Chain.hs
Variation and feedback on Michael Bernstein's Markov chain implementation
module Chain where
import Control.Applicative
import Data.List (tails, unfoldr)
import System.Random (RandomGen, newStdGen, randomR)
import qualified Data.Map.Strict as M
import Data.Sequence as S (Seq, (><), (|>))
import qualified Data.Sequence as S

Keybase proof

I hereby claim:

  • I am pjdelport on github.
  • I am pjdelport (https://keybase.io/pjdelport) on keybase.
  • I have a public key whose fingerprint is 5A44 5F43 932D FC9D 883B 84ED 1329 29ED A54F 5DCB

To claim this, I am signing this object:

@PiDelport
PiDelport / curried.scm
Last active January 12, 2016 00:50
This snippet defines curried versions of lambda and define, and was originally posted on #scheme (Freenode IRC, 2007)
;;; Analogous to lambda, but curried.
(define-syntax curried
(syntax-rules ()
((curried () body ...) (lambda () body ...))
((curried (arg) body ...) (lambda (arg) body ...))
((curried (arg args ...) body ...)
(lambda (arg . rest)
(let ((next (curried (args ...) body ...)))
(if (null? rest)
next
@PiDelport
PiDelport / format_call.py
Last active October 10, 2015 21:48
Format a function call as a string.
import inspect
def format_call(func, *positional, **named):
_locals = inspect.getcallargs(func, *positional, **named)
spec = inspect.getargspec(func)
argvalues = inspect.formatargvalues(spec.args, spec.varargs, spec.keywords, _locals)
return '{}{}'.format(func.__name__, argvalues)
@PiDelport
PiDelport / pkg_tree.py
Last active October 9, 2015 08:17
Visualize Python distribution dependency graphs.
#!/usr/bin/env python
"""
Running::
python pkg_tree.py | dot -Txlib
Requires `pydot`.
"""
import pkg_resources
#!/bin/sh -e
dist="tinymce_${1:?}.zip"
wget -N "http://github.com/downloads/tinymce/tinymce/$dist"
unzip "$dist"
rm -r tinymce/examples
mv tinymce/changelog.txt tinymce_changelog.txt
cp -a tinymce/jscripts/tiny_mce/* js/tinymce/resources