Skip to content

Instantly share code, notes, and snippets.

@atoponce
atoponce / readme.md
Last active October 17, 2020 16:53
Password generation in the shell

Simple Shell Password Generation

Just using the shell, either with built-in tools, or 3rd party generators, for building passwords with at least 70-bits of entropy (1 in at least 1,180,591,620,717,411,303,424 possibilities).

Each provide their own advantages and disadvantages.

Built-in Tools

All graphical keyboard characters

All possible 94 graphical characters (not the or) are

{-# LANGUAGE FlexibleInstances #-}
module MiniToneInference where
import Prelude hiding ((&&))
import Control.Applicative
import Control.Monad
import Data.Map.Strict (Map, (!))
import Data.Maybe (fromJust)
import Data.Monoid ((<>))
import Data.Set (isSubsetOf)
@kokes
kokes / 01porady.py
Created March 28, 2018 19:35
stahovani titulku z ivysilani
"""
Stáhni seznam pořadů z webu iVysílání
"""
import json
from urllib.parse import urljoin
import lxml.html
burl = 'http://www.ceskatelevize.cz/ivysilani/podle-abecedy'
ht = lxml.html.parse(burl).getroot()
@sjoerdvisscher
sjoerdvisscher / laws.hs
Last active July 24, 2018 08:16
First class checkable laws using the free-functors package
{-# LANGUAGE
TypeFamilies
, KindSignatures
, ScopedTypeVariables
, ConstraintKinds
, FlexibleInstances
, FlexibleContexts
, DeriveGeneric
, DeriveAnyClass
, TypeApplications
@Icelandjack
Icelandjack / gist:3a98d3979879fd9415bbde3761c51760
Created March 18, 2018 14:41
HFree + QuantifiedConstraints
-- Response to
-- https://gist.github.com/sjoerdvisscher/e8ed8ca8f3b6420b4aebe020b9e8e235
-- https://twitter.com/sjoerd_visscher/status/975375241932427265
{-# Language QuantifiedConstraints, TypeOperators, RankNTypes, GADTs, ConstraintKinds, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances, PolyKinds, InstanceSigs #-}
import Data.Coerce
type f ~> g = forall x. f x -> g x
@dpiponi
dpiponi / main.hs
Created February 17, 2018 20:16
Infinitely differentiable stochastic functions
{- LANGUAGE UnicodeSyntax -}
import Prelude hiding (sum)
import Control.Monad
import qualified System.Random as R
import qualified Data.Map.Strict as M
--
-- Define formal power series
-- I'm just using lists of coefficients rather than defining a new type.
@dorchard
dorchard / CBNLambdaEff.hs
Last active November 15, 2018 20:40
A Haskell implementation of the categorical semantics for the effectful CBN lambda calculus
{-# LANGUAGE GADTs, TypeFamilies, EmptyDataDecls #-}
{-
A Haskell-based implementation of the monadic semantics for the
simply-typed Call-By-Name computational lambda calculus, following
Moggi's 'Computational lambda-calculus and monads' (1989) (technical report version)
but for the typed calculus (rather than untyped as in this paper).
Category theory seminar, Programming Languages and Systems group,
@dpiponi
dpiponi / main.hs
Created November 25, 2017 18:30
Primality test based on Chebyshev polynomials
import Data.Bits
import Control.Monad
type Z = Integer
-- Find smallest power of two >= given integer.
-- Sadly it's not convenient using the usual interface to Integer
-- Got exceptions when using Data.Bits.Bitwise
suitablePower :: Z -> Int
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE PatternGuards #-}
module Unification where
import Control.Monad
import Control.Monad.Gen
import Control.Monad.Trans
import qualified Data.Map.Strict as M
import Data.Foldable
import Data.Monoid
@briansmith
briansmith / how-to-generate-and-use-private-keys-with-openssl-tool.md
Last active April 11, 2024 17:02
How to generate & use private keys using the OpenSSL command line tool

How to Generate & Use Private Keys using OpenSSL's Command Line Tool

These commands generate and use private keys in unencrypted binary (not Base64 “PEM”) PKCS#8 format. The PKCS#8 format is used here because it is the most interoperable format when dealing with software that isn't based on OpenSSL.

OpenSSL has a variety of commands that can be used to operate on private key files, some of which are specific to RSA (e.g. openssl rsa and openssl genrsa) or which have other limitations. Here we always use