Skip to content

Instantly share code, notes, and snippets.

View yalattas's full-sized avatar

Yasser Alattas yalattas

View GitHub Profile
@yalattas
yalattas / openssl.md
Last active September 23, 2024 01:28
SSH-PEM-to-PFX

root

openssl pkcs12 -export -out rootca.pfx -in <FILE_NAME>.pem -nokeys

certificate

openssl pkcs12 -export -out mycert.pfx -inkey private.pem -in public.crt

@yalattas
yalattas / .sops.yaml
Last active January 31, 2024 20:57
Mozilla sops
creation_rules:
- filename_regex: '.*/secrets\.y(a)?ml$' # looking for all `secrets.yaml` files and encrypt
kms: 'arn:aws:kms:AWS_REGION:12345678912:alias/KMS_ALIAS'
aws_profile: PROFILE
@yalattas
yalattas / logger.md
Last active October 10, 2023 13:50
python
import logging

# create a new logger
logger = logging.getLogger('main')

# set logger level
logger.setLevel(logging.DEBUG)

# stream log into console by creating a handler
@yalattas
yalattas / git
Last active May 9, 2024 13:14
git operation
## checkout to all branches in remote
```
#!/bin/bash
#Whenever you clone a repo, you do not clone all of its branches by default.
#If you wish to do so, use the following script:
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v main `; do
git branch --track ${branch#remotes/origin/} $branch
done
@yalattas
yalattas / ERPnext-ubuntu-deployment.md
Last active June 4, 2023 12:12
erpnext ubuntu setup

ERPnext VM deployment

server

sudo timedatectl set-timezone "Asia/Riyadh"
sudo apt-get update -y
sudo apt-get upgrade -y
sudo reboot

openssl

establish secure connection using Curl

  1. fetch public certificate to a website
openssl s_client -connect example.com:443 -showcerts </dev/null 2>/dev/null | openssl x509 -outform PEM > ca.crt
  1. generate self-signed certificate
openssl req -newkey rsa:2048 -nodes -keyout client.key -x509 -days 365 -out client.crt
@yalattas
yalattas / generate-ssh-key.sh
Created March 13, 2023 14:25 — forked from denisgolius/generate-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa