Skip to content

Instantly share code, notes, and snippets.

View cemtopkaya's full-sized avatar
🏠
Working from home

Cem Topkaya cemtopkaya

🏠
Working from home
View GitHub Profile
@pcan
pcan / README.md
Last active July 7, 2024 01:28
Node.js plain TLS Client & Server, 2-way Cert Auth

Node.js TLS plain TLS sockets

This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.

Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.

Prepare certificates

Generate a Certificate Authority:

@wzulfikar
wzulfikar / docker-ps-vertical
Last active March 14, 2024 13:36
vertical format for docker ps
export FORMAT="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n"
// usage:
docker ps --format="$FORMAT"
@joepie91
joepie91 / monolithic-vs-modular.md
Last active August 2, 2023 08:17
Monolithic vs. modular - what's the difference?

When you're developing in Node.js, you're likely to run into these terms - "monolithic" and "modular". They're usually used to describe the different types of frameworks and libraries; not just HTTP frameworks, but modules in general.

At a glance

  • Monolithic: "Batteries-included" and typically tightly coupled, it tries to include all the stuff that's needed for common usecases. An example of a monolithic web framework would be Sails.js.
  • Modular: "Minimal" and loosely coupled. Only includes the bare minimum of functionality and structure, and the rest is a plugin. Fundamentally, it generally only has a single 'responsibility'. An example of a modular web framework would be Express.

Coupled?

In software development, the terms "tightly coupled" and "loosely coupled" are used to indicate how much components rely on each other; or more specifically, how many assumptions they make about each other. This directly translates to how easy it is to repla

@iammapping
iammapping / execSync
Created July 17, 2014 04:04
simple exec sync in nodejs
var fs = require('fs');
var exec = require('child_process').exec;
/**
* execSync
*
* simple version of execSync
* refer to 'shelljs -> exec', https://github.com/arturadib/shelljs/blob/master/src/exec.js
* @param {String} cmd
* @param {Object} option
@irazasyed
irazasyed / sourceTree-git-fix.md
Created March 11, 2014 15:42
Git: SourceTree - Remote Error fix for Windows Users.

This works if you authenticate using a public/private key pair:

  • Open Sourcetree and go to "Tools > Create or Import SSH Keys" (this will open a PuTTY Key Generator window), Set the number of bits in a generated key to 2048 and click on "Generate".

  • Once generated go to git server panel and navigate to "My account > Profile > SSH Keys" and click "Add a public key".

  • Copy the generated public key from the "PuTTY Key Generator" window ("Public key for pasting into OpenSSH authorized_keys file:") to git panel and save it.

  • In the "PuTTY Key Generator" window enter a "Key passphrase" and "Confirm passphrase" and click "Save private key" and Public Key (for other uses too). Make sure to save it somewhere where you can find it again.

@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active July 11, 2024 10:06
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh keys
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <rob@rob.tn>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network