Skip to content

Instantly share code, notes, and snippets.

View olbboy's full-sized avatar
💭
🏆

mds olbboy

💭
🏆
View GitHub Profile
@olbboy
olbboy / git-ssh-error-fix.sh
Created October 24, 2023 08:38 — forked from Tamal/git-ssh-error-fix.sh
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@olbboy
olbboy / example-vault-admin-policy.hcl
Created September 15, 2023 07:57 — forked from kawsark/example-vault-admin-policy.hcl
An example Vault admin policy with capability to manage leses
# Allow managing leases
path "sys/leases/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}
# Manage auth methods broadly across Vault
path "auth/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
@olbboy
olbboy / flatten-response.js
Created September 21, 2022 04:36 — forked from hucancode/README.md
Flatten Strapi 4's response JSON
// src/middlewares/flatten-response.js
function flattenArray(obj) {
return obj.map(e => flatten(e));
}
function flattenData(obj) {
return flatten(obj.data);
}
function flattenAttrs(obj) {
@olbboy
olbboy / haproxy_letsencrypt.md
Created May 12, 2022 11:20 — forked from lmmendes/haproxy_letsencrypt.md
# HAProxy and Let's Encrypt

HAProxy and Let's Encrypt

HAProxy is a open-source TCP/HTTP load-balancing proxy server supporting native SSL, keep-alive, compression CLI, and other modern features.

Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public’s benefit. Let’s Encrypt is a service provided by the Internet Security Research Group (ISRG).

Concept

const minute = 60;
const hour = minute * 60;
const day = hour * 24;
const week = day * 7;
const month = day * 30;
const year = day * 365;
/**
* Convert a date to a relative time string, such as
* "a minute ago", "in 2 hours", "yesterday", "3 months ago", etc.
@olbboy
olbboy / tpbd
Created February 11, 2022 06:52
.
├── Quần nữ
│ ├── Quần lụa thường
│ ├── Quần váy
│ ├── Quần lửng
│ ├── Quần tico
│ ├── Quần trắng
│ ├── Quần trắng nữ
│ ├── Quần đen
│ ├── Quần liền tà
@olbboy
olbboy / self-signed_ssl.txt
Created January 5, 2022 18:28 — forked from jelinden/self-signed_ssl.txt
Jetty self-signed ssl certification
sudo openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.old
openssl rsa -in server.key.old -out server.key
sudo openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt
sudo openssl pkcs12 -inkey server.key -in server.crt -export -out server.pkcs12
keytool -importkeystore -srckeystore server.pkcs12 -srcstoretype PKCS12 -destkeystore keystore
keytool -list -v -keystore keystore
java -cp /jetty-8.1.3/lib/jetty-util-8.1.3.v20120416.jar org.eclipse.jetty.util.security.Password password
# Install qemu
apt-get update && apt-get install qemu -y
apt install qemu-utils
apt install qemu-system-x86
# Create disk image
qemu-img create -f raw windows10.img 16G
# Get virtio drivers
wget -O virtio-win.iso 'https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.185-2/virtio-win-0.1.185.iso'
@olbboy
olbboy / installing-node-with-nvm.md
Created August 17, 2021 08:54 — forked from d2s/installing-node-with-nvm.md
Installing Node.js to Linux & macOS & WSL with nvm

Installing Node.js with nvm to Linux & macOS & WSL

A quick guide on how to setup Node.js development environment.

Install nvm for managing Node.js versions

nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.

  1. Open new Terminal window.