Skip to content

Instantly share code, notes, and snippets.

View meysam81's full-sized avatar
📝
Learning

Meysam meysam81

📝
Learning
View GitHub Profile
name=world
double_quote="hello $name"
single_quote='hello '"$name"''
echo $double_quote
echo $single_quote
# output:
# hello world
# syntax=docker/dockerfile:1
FROM --platform=${TARGETPLATFORM} python:3.12-alpine
ARG TARGETARCH
ADD --chmod=755 https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-${TARGETARCH} /usr/local/bin/tini
RUN apk update && apk upgrade
ENTRYPOINT ["/usr/local/bin/tini", "--"]
def get_logger(level="INFO"):
logger = logging.getLogger(__name__)
logger.setLevel(level)
handler = logging.StreamHandler()
handler.setLevel(level)
formatter = logging.Formatter(
"[%(levelname)s] %(asctime)s - %(filename)s:%(lineno)d - %(message)s"
)
#!/bin/bash
total_seconds=0
while true; do
((total_seconds++))
printf -v time_string "%dd %dy %dm %dw %dd %dh %dm %ds" $((total_seconds / 290304000)) $((total_seconds % 290304000 / 29030400)) $((total_seconds % 29030400 / 2419200)) $((total_seconds % 2419200 / 604800)) $((total_seconds % 604800 / 86400)) $((total_seconds % 86400 / 3600)) $((total_seconds % 3600 / 60)) $((total_seconds % 60))
echo "${time_string// 0[dymwdhs]/} passed"
sleep 1
done
import React, { useState, useEffect } from 'react';
import styles from './MotdForm.module.css';
const MotdForm = () => {
const [motd, setMotd] = useState('');
const [isEditing, setIsEditing] = useState(false);
const MOTD_EXPIRATION_KEY = 'motdExpiration';
const MOTD_KEY = 'motd';
This file has been truncated, but you can view the full file.
2024-03-26T13:03:45.224+0700 [INFO] Terraform version: 1.7.3
2024-03-26T13:03:45.224+0700 [DEBUG] using github.com/hashicorp/go-tfe v1.41.0
2024-03-26T13:03:45.224+0700 [DEBUG] using github.com/hashicorp/hcl/v2 v2.19.1
2024-03-26T13:03:45.224+0700 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2024-03-26T13:03:45.224+0700 [DEBUG] using github.com/zclconf/go-cty v1.14.1
2024-03-26T13:03:45.224+0700 [INFO] Go runtime version: go1.21.5
2024-03-26T13:03:45.224+0700 [INFO] CLI args: []string{"/home/meysam/.tfenv/versions/1.7.3/terraform", "plan", "-no-color", "-out", "tfplan"}
2024-03-26T13:03:45.224+0700 [TRACE] Stdout is not a terminal
2024-03-26T13:03:45.224+0700 [TRACE] Stderr is not a terminal
2024-03-26T13:03:45.225+0700 [TRACE] Stdin is a terminal
curl -sSfLo docker compose \
“https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64”
chmod +x docker compose
mkdir -p ~/.docker/cli-plugins
mv docker-compose ~/.docker/cli-plugins
RUN curl -sSfLo dumb-init \
"https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64" && \
chmod +x dumb-init && \
mv dumb-init /usr/local/bin/dumb-init
ENTRYPOINT [“/usr/local/bin/dumb-init”, “--”]
@meysam81
meysam81 / controlplane-playbook.yml
Created January 27, 2024 09:35
Passing vars files to the controlplane configuration
- name: Bootstrap Kubernetes Control plane
hosts: node0
become: true
gather_facts: true
vars_files:
- "{{ playbook_dir }}/vars/etcd.yml"
- "{{ playbook_dir }}/vars/k8s.yml"
- "{{ playbook_dir }}/vars/tls.yml"
tasks:
@meysam81
meysam81 / main.yml
Created January 27, 2024 09:32
Use the KubeConfig template to generate client configuration to the Kubernetes API server for different components
- name: Generate KubeConfig for Kubernetes components
ansible.builtin.template:
src: kubeconfig.yml.j2
dest: /var/lib/kubernetes/{{ item }}-kubeconfig.yml
mode: "0640"
owner: root
group: root
vars:
client_cert_path: /etc/kubernetes/pki/{{ item }}.crt
client_key_path: /etc/kubernetes/pki/{{ item }}.key