Categories
General

Tamil Handwriting

Categories
WordPress

Markdown Commands

ElementMarkdown Syntax
Heading# H1
## H2
### H3
Bold**bold text**
Italic*italicized text*
Blockquote> blockquote
Ordered List1. First item
2. Second item
3. Third item
Unordered List– First item
– Second item
– Third item
Code`code`
Horizontal Rule
Link[title](https://www.example.com)
Image![alt text](image.jpg)
Table| Syntax | Description |
| ———– | ———– |
| Header | Title |
| Paragraph | Text |
Fenced Code Block“`
{
“firstName”: “John”,
“lastName”: “Smith”,
“age”: 25
}
“`
FootnoteHere’s a sentence with a footnote. [^1]

[^1]: This is the footnote.
Heading ID### My Great Heading {#custom-id}
Definition Listterm
: definition
Strikethrough~~The world is flat.~~
Task List– [x] Write the press release
– [ ] Update the website
– [ ] Contact the media
Emoji
(see also Copying and Pasting Emoji)
That is so funny! :joy:
HighlightI need to highlight these ==very important words==.
SubscriptH~2~O
SuperscriptX^2^
Categories
WordPress

Gutenberg Block Editor Shortcuts

Duplicate the selected block(s)Ctrl + Shift + D
Unselect selected block(s)double escape
Remove the selected block(s)Shift + Alt + Z
Insert a new block before the selected block(s)Ctrl + Alt + T
Insert a new block after the selected block(s)Ctrl + Alt + Y
Remove multiple selected blocksdel
backspace
Move the selected block(s) upCtrl + Shift + Alt + T
Move the selected block(s) downCtrl + Shift + Alt + Y
Change the block type after adding a new paragraph/
Categories
Python

Python Package

Poetry

poetry new .
extendedjson
├───extendedjson
│   └───__init__.py
├───tests
│   ├───__init__.py
│   └───test_extendedjson.py
├───pyproject.toml
└───README.rst
[tool.poetry]
name = "extendedjson"
version = "0.1.0"
description = ""
authors = ["Praison"]

[tool.poetry.dependencies]
python = "^3.8"

[tool.poetry.dev-dependencies]
pytest = "^5.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
poetry install

Repositories

git init
git add *
git commit -m "First commit"
git branch -M main
git remote add origin https://github.com/test/extendedjson.git
git push -u origin main

Pre commit hooks

poetry add -D pre-commit
git add poetry.lock pyproject.toml
git commit -m "Add pre-commit dependency."

.pre-commit-config.yaml

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.0.1
    hooks:
      - id: check-toml
      - id: check-yaml
      - id: end-of-file-fixer
      - id: mixed-line-ending
  - repo: https://github.com/psf/black
    rev: 22.3.0
    hooks:
      - id: black
  - repo: https://github.com/PyCQA/isort
    rev: 5.10.1
    hooks:
      - id: isort
        args: ["--profile", "black"]
pre-commit install
pre-commit run all-files
git add pyproject.toml poetry.lock .pre-commit-config.yaml
git commit -m "Add pre-commit dependency."
git add *
git commit -m "Run all pre-commits."
git push

Test Repository

poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config http-basic.testpypi __token__ pypi-your-api-token-here
poetry build
poetry publish -r testpypi

Publish

poetry config pypi-token.pypi pypi-your-token-here
poetry publish --build

Writing Tests

tests/test_extendedjson.py

from extendedjson import __version__

def test_version():
    assert __version__ == "0.1.0"
λ pytest
========================= test session starts =========================
platform win32 -- Python 3.8.5, pytest-5.4.3, py-1.11.0, pluggy-0.13.1
rootdir: C:\Users\rodri\Documents\Programming\extendedjson
collected 5 items

tests\test_extendedjson.py .....                                 [100%]

========================== 5 passed in 0.06s ==========================
Categories
Database

MySQL Configure Password

Main Method

$ sudo mysql_secure_installation

Alternate method

Using sudo

$ sudo mysql -u root

Create a new database:

CREATE DATABASE newdb;

Grant privileges to a new user:

GRANT ALL ON newdb.* TO yournewuser@localhost IDENTIFIED BY 'yourpassword';
FLUSH privileges;
Categories
Python

Python Change Version

update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9 1
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 2
Categories
Containers

OPcache in Docker

[opcache]
opcache.enable=1
opcache.revalidate_freq=0
opcache.validate_timestamps=0
opcache.max_accelerated_files=10000
opcache.memory_consumption=192
opcache.max_wasted_percentage=10
opcache.interned_strings_buffer=16
opcache.fast_shutdown=1
FROM php:8.1-fpm-alpine

# Install build dependencies and the OPcache extension
RUN apk add --no-cache $PHPIZE_DEPS \
    && docker-php-ext-install opcache \
    && apk del $PHPIZE_DEPS

# Copy the opcache.ini into your Docker image    
COPY docker/php/opcache.ini /usr/local/etc/php/conf.d/opcache.ini

# Run your application
CMD php-fpm
Categories
Containers

Cluster Role Binding in K8s

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard
Categories
DevOps

DevOps Pets Vs Cattles

Immutable (Type 3)Immutable Cattle (Type 2)Mutable Pets ( Type 1)
Stateless ServersWeb array serversMainframes
Web ServerManagement ServersSolitary Servers
Application ServerMulti-master datastores Load balancers
 HPC Head Node / Compute NodesFirewalls
  Database systems
  AD Domain Controllers
Categories
Linux

Linux Add Bridge Network with Static IP

#!/bin/bash
ifconfig eth0 192.168.0.82 netmask 255.255.255.0 up
route add default gw 192.168.0.254 eth0
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf