Skip to content

Instantly share code, notes, and snippets.

@chemist
chemist / gpg-ssh-setup.md
Created December 24, 2021 05:26 — forked from mcattarinussi/gpg-ssh-setup.md
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@chemist
chemist / kubernetes_add_service_account_kubeconfig.sh
Created March 4, 2020 07:57 — forked from innovia/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: your-namespace
namespace: your-namespace
rules:
- apiGroups:
- ""
resources:
- pods
set nocompatible " be iMproved, required
set backspace=2
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#rc()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
data Passport = Passport Word8 Word32
parsePassport :: Parser (Either ByteString Passport)
parsePassport = good <|> bad
where
bad = Left <$> takeWhile (/= '\n') <* endOfLine
good = Right <$> (Passport <$> label <*> body <* endOfLine)
where
extern crate parser_combinators as pc;
use pc::*;
use pc::primitives::{State, Stream};
fn main() {
match parser(parse_passport).parse("a123,456") {
Ok((r,l)) => println!("{} {} {}", r.label, r.body, l),
Err(e) => println!("{}", e)
}
}
@chemist
chemist / yi.hs
Created August 4, 2014 14:51
my config for yi
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Yi
import Yi.Keymap.Vim (keymapSet, mkKeymapSet, defVimConfig, pureEval, impureEval, VimConfig(..), VimBinding(..))
import Yi.Keymap.Vim.Common (VimMode(..), RepeatToken(..))
import Yi.Keymap.Vim.Utils (mkStringBindingE, mkStringBindingY)
import qualified Yi.Mode.Haskell as Haskell
import Yi.Style
import Yi.Core (msgEditor)
import Yi.Style.Library
module Main where
import qualified Data.Map as Map
import Data.Either (lefts, rights)
data DbColumn = DbColumn { name :: String
, tableName :: TableName
} deriving Show
newtype TableName = TableName String deriving (Ord, Eq, Show)
@chemist
chemist / MVar vs TMVar vs IORef
Created June 24, 2013 20:18
Performance test MVar vs TMVar vs IORef. Just read.
~/develop/bench -$ cat Main.hs iMac-Alexej@chemist :)
import Control.Concurrent
import Control.Concurrent.STM
import Criterion.Main
import Data.IORef
main = do
mv <- newMVar ()
tv <- newTMVarIO ()
@chemist
chemist / Main.hs
Created June 21, 2013 06:07
objects in haskell
{-# LANGUAGE RecordWildCards #-}
module Main where
import Data.Time
import Data.Set
import Data.Monoid
type Req = (String, String)
type Rules = [String]
type Ip = String