Skip to content

Instantly share code, notes, and snippets.

View toorosan's full-sized avatar
:octocat:
working

Evgeny Kabantsev toorosan

:octocat:
working
  • Acronis International GmbH
  • Maastricht, Netherlands
View GitHub Profile

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");
@toorosan
toorosan / README.md
Created July 25, 2020 09:50 — forked from noamtamim/README.md
Markdown with PlantUML

How to use PlantUML with Markdown

PlantUML is a really awesome way to create diagrams by writing code instead of drawing and dragging visual elements. Markdown is a really nice documentation tool.

Here's how I combine the two, to create docs with embedded diagrams.

Step 0: Setup

Get the command-line PlantUML from the download page or your relevant package manager.

@toorosan
toorosan / install virtualenv ubuntu 16.04.md
Created April 8, 2020 09:49 — forked from frfahim/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@toorosan
toorosan / deencrypt_3des.go
Created March 31, 2020 15:38 — forked from wklken/deencrypt_3des.go
3des: encrypt with python & deencrypt with golang
package main
// reference: https://golang.org/pkg/crypto/des/
// reference: http://blog.studygolang.com/2013/01/go%E5%8A%A0%E5%AF%86%E8%A7%A3%E5%AF%86%E4%B9%8Bdes/
import (
"crypto/cipher"
"crypto/des"
"encoding/base64"
"encoding/json"
@toorosan
toorosan / README.md
Created November 13, 2019 16:14 — forked from pklaus/README.md
Generating Random MAC Addresses with Python

The mini-tool has a CLI-Interface with the following options:

  • Unicast or Multicast? Default: Unicast
  • Locally Administered or Globally Unique? Default: Locally Administered
  • Prescribe specific OUI (overwrites the above two)

TODO

  • Add an option to generate a number of MACs without collisions.
@toorosan
toorosan / golang-tls.md
Created June 13, 2019 14:31 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@toorosan
toorosan / patterns.go
Created April 7, 2019 05:57
Programmatic patterns
// Chained functions.
type Chained struct {
someUpdatedValue string
}
// ModifyFunction1 makes concatenation of someUpdatedValue and s, divided by "+"
func (c Chained) ModifyFunction1(s string) Chained {
return Chained{someUpdatedValue: c.someUpdatedValue + "+" + s}
}
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@toorosan
toorosan / serve.go
Created June 14, 2018 16:33 — forked from rivo/serve.go
Graceful stop and restart for HTTP servers in Go
package main
import (
"context"
"fmt"
"net"
"net/http"
"os"
"os/exec"
"os/signal"
@toorosan
toorosan / readme.md
Created June 5, 2018 19:28 — forked from thomasdarimont/readme.md
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Setup

Add this to your .profile, .bashrc, .zshrc...

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
  if [ $len -eq 2 ]; then result="$1"'=='
  elif [ $len -eq 3 ]; then result="$1"'=' 
  fi
 echo "$result" | tr '_-' '/+' | openssl enc -d -base64