Skip to content

Instantly share code, notes, and snippets.

@tuansoibk
tuansoibk / cryptography-file-formats.md
Last active April 15, 2024 17:07
Cryptography material conversion and verification commands
  1. Introduction
  2. Standards
  3. Common combinations
  4. Conversion
  5. Verification/Inspection
  6. Tips for recognising

Introduction

It happens that there are many standards for storing cryptography materials (key, certificate, ...) and it isn't always obvious to know which standard is used by just looking at file name extension or file content. There are bunch of questions on stackoverflow asking about how to convert from PEM to PKCS#8 or PKCS#12, while many tried to answer the questions, those answers may not help because the correct answer depends on the content inside the PEM file. That is, a PEM file can contain many different things, such as an X509 certificate, a PKCS#1 or PKCS#8 private key. The worst-case scenario is that someone just store a non-PEM content in "something.pem" file.

@stevecondylios
stevecondylios / resize-image-in-github-issue-github-flavored-markdown.md
Last active April 27, 2024 19:04
How to Resize an Image in a Github Issue (e.g. Github flavored Markdown)

How to Resize an Image in Github README.md (i.e. Github Flavored Markdown)

Percentage:

<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width=50% height=50%>

Pixels:

<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width="150" height="280">

version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT
container_name: elasticsearch
environment:
- network.host=0.0.0.0
- discovery.type=single-node
- cluster.name=docker-cluster
- node.name=cluster1-node1
@fworks
fworks / install-zsh-windows-git-bash.md
Last active April 19, 2024 19:52
Zsh / Oh-my-zsh on Windows Git Bash
@caruccio
caruccio / getopts.md
Last active November 3, 2023 22:07
Read shell options with positional arguments

This example shows how to read options and positional arguments from a bash script (same principle can be applied for other shells).

# some global var we want to overwrite with options
force=false
help=false
log=info
ARGS=() ### this array holds any positional arguments, i.e., arguments not started with dash

while [ $# -gt 0 ]; do
@ivanbrennan
ivanbrennan / show-256-colors.sh
Last active August 12, 2023 20:12
Use Bash to show all 256 colors supported by xterms
#!/usr/bin/env bash
PADDING='Padding'
main() {
local xterm_start=0 \
xterm_width=8 \
xterm_height=2
local cube_start=$((xterm_start + xterm_width * xterm_height)) \
@Bekbolatov
Bekbolatov / tmux.md
Last active March 7, 2024 01:18
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
@bertvv
bertvv / pandoc.Makefile
Last active November 24, 2022 08:55
Makefile for Markdown -> PDF using pandoc
# Generate PDFs from the Markdown source files
#
# In order to use this makefile, you need some tools:
# - GNU make
# - Pandoc
# - LuaLaTeX
# - DejaVu Sans fonts
# Directory containing source (Markdown) files
source := src
@mgedmin
mgedmin / show-all-256-colors.py
Last active August 24, 2023 16:23
Script to show all 256 colors supported by xterms
#!/usr/bin/python
"""Print a swatch using all 256 colors of 256-color-capable terminals."""
__author__ = "Marius Gedminas <marius@gedmin.as>"
__url__ = "https://gist.github.com/mgedmin/2762225"
__version__ = '2.0'
def hrun(start, width, padding=0):