This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from dataclasses import dataclass, fields, is_dataclass | |
from typing import TypeVar | |
@dataclass | |
class Widget: | |
name: str | |
amount: int | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
n=1 | |
sep=- | |
while [ $# -ne 0 ]; do | |
case "$1" in | |
-n) n=$2; shift; shift;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from Pretty-Groovy.txt.groovy | |
import com.intellij.openapi.util.text.StringUtil | |
/* | |
* Available context bindings: | |
* COLUMNS List<DataColumn> | |
* ROWS Iterable<DataRow> | |
* OUT { append() } | |
* FORMATTER { format(row, col); formatValue(Object, col); getTypeName(Object, col); isStringLiteral(Object, col); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env stack | |
{- stack | |
--resolver lts-18.27 | |
--install-ghc runghc | |
--package aeson | |
--package containers | |
--package http-client | |
--package http-types | |
--package monad-logger | |
--package text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ContextLifted where | |
import Control.Monad.Catch (MonadMask) | |
import Control.Monad.IO.Class | |
import qualified Context | |
import qualified Context.Internal | |
import qualified Control.Monad.Catch as Monad.Catch | |
adjust :: (MonadIO m, MonadMask m) => Context.Store ctx -> (ctx -> ctx) -> m a -> m a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% curl \ | |
-XPOST https://httpbin.org/post \ | |
-G \ | |
--data-urlencode foo=bar \ | |
--data-urlencode baz=quux \ | |
-T <(echo -n '{"spam": "eggs"}') | |
{ | |
"args": { | |
"baz": "quux", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module STMUtil where | |
import Prelude | |
import Control.Concurrent.STM (STM) | |
import Data.HashMap.Strict (HashMap) | |
import Data.Hashable (Hashable) | |
import qualified Data.HashMap.Strict as HashMap | |
import qualified Debug.Trace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import itertools | |
import sys | |
import re | |
vowels=set('aeiou') | |
alpha_only = re.compile('^[a-z]+$') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE DerivingStrategies #-} | |
{-# LANGUAGE NamedFieldPuns #-} | |
{-# LANGUAGE QuasiQuotes #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeApplications #-} | |
module THPlayground.Main where | |
import Control.Exception |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while IFS= read -r -d $'\n'; do | |
rm "$REPLY" | |
done < <( | |
git ls-files --others --exclude-standard \ | |
| fzf -m \ | |
--header='Select untracked files to delete (press TAB to select multiple)' \ | |
--layout=reverse | |
) |
NewerOlder