This file contains 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 bash | |
# | |
# DISCLAIMER: I am not sure this script won't nuke the content of your tpm module, so please, | |
# accept this risk before continuing. | |
# | |
# This script condensates the receipt found at https://incenp.org/notes/2020/tpm-based-ssh-key.html | |
# for an archlinux system. Running it will eventually install the dependencies, initialize the | |
# tpm2_pkcs11 store and generate a token and a key. From the key, an ssh public key will be generated. | |
# You can customize the some setting with env variables: KEY_PATH overrides the default path where the | |
# key is stored (~/.ssh/tpm2.key); with KEY_ALGO you can override the algorithm used to generate the key |
This file contains 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 | |
if [ "z$DEBUG" != "z" ]; then | |
set -x | |
fi | |
_NOTES_PATH=${NOTES_PATH:-~/notes} | |
export FZF_DEFAULT_OPTS="-m --ansi --preview-window 'right:70%' --preview 'bat --color=always --style=header,grid --line-range :300 ${_NOTES_PATH}/{}'" |
This file contains 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
// Playing with cons from https://doc.rust-lang.org/book/ch15-01-box.html | |
#[derive(Clone)] | |
pub enum Chain<T: Clone> { | |
Link(T, Box<Chain<T>>), | |
Nil, | |
} | |
impl<T: Clone> Chain<T> { | |
pub fn new(capacity: usize, initializer: T) -> Self { | |
let start = Self::Nil; |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
struct ring_int { | |
struct ring_int *next; | |
int value; | |
} ring_int; | |
struct ring_int *new_ring(int capacity, int placeholder); |
This file contains 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
use std::ptr; | |
#[derive(Clone)] | |
pub struct Ring<T: Clone> { | |
head: *mut Node<T>, | |
capacity: usize, | |
} | |
impl<T: Clone> Ring<T> { | |
pub fn capacity(&self) -> usize { |
This file contains 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
### colored and fuzzy go doc | |
if which bat > /dev/null; then | |
function _godoc() { | |
if echo $1|grep -q -E "^([a-zA-Z0-9/]+)$"; then | |
go doc ${@} | bat -p -l md | |
elif echo $1|grep -q -E "^[a-zA-Z0-9/]+\.[a-zA-Z0-9.]+$"; then | |
go doc ${@} | bat -p -l go | |
elif echo $1|grep -q -E "^([a-zA-Z0-9/._-]+)/.*\.[a-zA-Z0-9.]+$"; then | |
go doc ${@} | bat -p -l go | |
else |
OlderNewer