- alt+left, alt+right - previous/next tab
- ctrl+tab, ctrl+shift+tab - alternate method of changing tabs, pops up a list with each tab's name
- ctrl+f4 - close current tab
- ctrl+f5 - close all other tabs
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
adjustLastSeq :: (a -> a) -> Seq a -> Seq a | |
adjustLastSeq f xs = Seq.adjust f (Seq.length xs - 1) xs |
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
padLeft :: Int -> a -> [a] -> [a] | |
padLeft l x xs = padding ++ xs where | |
padding = replicate (max 0 $ l - length xs) x |
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 Data.Set (Set) | |
import qualified Data.List as List | |
import qualified Data.Set as Set | |
setPermutations :: Set a -> [[a]] | |
setPermutations = List.permutations . Set.toList |
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 Data.Set (Set) | |
import qualified Data.Set as Set | |
kSubsetPermutations :: Ord a => Int -> Set a -> [[a]] | |
kSubsetPermutations 0 _ = [] | |
kSubsetPermutations 1 xs = map (\x -> [x]) $ Set.toList xs | |
kSubsetPermutations k xs = concatMap f $ Set.toList xs where | |
f x = map (x :) $ kSubsetPermutations (k-1) $ Set.delete x xs |
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
splitAt2 :: Int -> Int -> [a] -> ([a], [a], [a]) | |
splitAt2 i j xs = let (q, r3) = splitAt j xs | |
(r1, r2) = splitAt i q | |
in (r1, r2, r3) |
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 Data.List (delete) | |
kSublistPermutations :: Eq a => Int -> [a] -> [[a]] | |
kSublistPermutations 0 _ = [] | |
kSublistPermutations 1 xs = map (\x -> [x]) $ xs | |
kSublistPermutations k xs = concatMap f xs where | |
f x = map (x :) $ kSublistPermutations (k-1) $ delete x xs |
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
-- untested! | |
nubSortBy :: Eq a => (a -> a -> Ordering) -> [a] -> [a] | |
nubSortBy f xs = nub $ sortBy f xs where | |
nub [] = [] | |
nub (x:[]) = [x] | |
nub (x:y:zs) | x == y = nub $ y:zs | |
nub (x:ys) = x:(nub ys) |
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 OverloadedStrings #-} | |
module ByteParsing (parseBytes) where | |
import Data.Either () | |
import Data.Maybe | |
import Data.Text (Text) | |
import qualified Data.Text as Text | |
import Data.Text.Read | |
import Data.Word8 (Word8) |
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
""" | |
Environment variables: | |
DEBUG | |
1 or 0 (default: 0) | |
DJANGO_SECRET_KE | |
The secret key. | |
DJANGO_SECRET_KEY_BASE64 |