Skip to content

Instantly share code, notes, and snippets.

View hatamiarash7's full-sized avatar
🤖
*beep boop* overworked !

Arash Hatami hatamiarash7

🤖
*beep boop* overworked !
View GitHub Profile
@hatamiarash7
hatamiarash7 / ilo.sh
Created April 16, 2023 08:26
Update iLO IP
cdr2mask ()
{
# Number of args to shift, 255..255, first non-255 byte, zeroes
set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
[ $1 -gt 1 ] && shift $1 || shift
echo ${1-0}.${2-0}.${3-0}.${4-0}
}
IP=$(echo $1 | cut -d '/' -f 1)
CDR=$(echo $1 | cut -d '/' -f 2)
@hatamiarash7
hatamiarash7 / README.md
Last active February 17, 2023 13:49
Bash Slugify string

How to create slug text in bash

We can use this command:

echo "My awesome title" | iconv -t ascii//TRANSLIT | sed -r 's/[~\^]+//g' | sed -r 's/[^a-zA-Z0-9]+/-/g' | sed -r 's/^-+\|-+$//g' | sed -r 's/-$//g' | tr A-Z a-z
@hatamiarash7
hatamiarash7 / snake.py
Created November 8, 2022 16:57
Python snake game
import pygame
import random
pygame.init()
white = (255, 255, 255)
yellow = (255, 255, 102)
black = (0, 0, 0)
red = (213, 50, 80)
green = (0, 255, 0)
@hatamiarash7
hatamiarash7 / sail.sh
Created July 4, 2022 13:54
Create Laravel project using Sail
docker info > /dev/null 2>&1
# Color codes
RED='\033[1;31m'
LIGHT_CYAN='\033[1;36m'
NC='\033[0m'
# Ensure that Docker is running...
if [ $? -ne 0 ]; then
echo -e "${RED}Docker is not running."
==> Install app
adb install Myapp.apk
adb -d install Myapp.apk // -d : directs command to the connected USB device
adb -e install Myapp.apk // -e : directs command to the running emulator
adb -s install Myapp.apk // -s : serial number
adb -p install Myapp.apk // -p : product name or path
----------------------------------------------------------------------------------------------------------
==> Uninstall app
# Arash WS
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBF8uzd0BCADI4CqwpIoTK/jEZ4Z+YRIYPNYQa5FPuIn1q9rOV6B0pq8H2OCU
NzdhQhgg5OM/ZjbeBqsRymmkFP1Na4OCPc0DzqJpwP0BPx3AfM//+CJJK25ioOzL
UxI5nEVNNn/nhSvsdVFpi7J41GQlz+jnfbamEJI/2cgyxU2Php9BtOzgPIaARaYO
7kWA3kx5zubCPWdieTLM2/WL+T1wC5nI8Il0UByPrSbmcalaYGxrVqZJaYmtG8EN
M3BlXaNVGO+4ntHXQuBXKUmUPeUO9uFGwR3Z49C41v4WP04Go4y7WByi4JNujWl1
Q5br0XLGnLz3sP1ADuOmjHxVqa8AdHaGYjWFABEBAAG0MEFyYXNoIEhhdGFtaSAo
QXJhc2gtV1MpIDxoYXRhbWlhcmFzaDdAZ21haWwuY29tPokBTgQTAQoAOBYhBJsm
@hatamiarash7
hatamiarash7 / dashboard.json
Created March 29, 2020 19:32
Minio dashboard for Grafana - Updated for minio version RELEASE.2020-03-19T21-49-00Z
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
@hatamiarash7
hatamiarash7 / daemon.yml
Created March 11, 2020 10:10
Kubernetes disable transparent huge pages
apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: kube-system
name: sysctl
spec:
selector:
matchLabels:
app: sysctl
template:
@hatamiarash7
hatamiarash7 / authentication.yml
Created February 22, 2020 21:27
Kubernetes Dashboard authentication method
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
@hatamiarash7
hatamiarash7 / DNS Switcher.md
Last active February 2, 2020 18:26
DNS switching script for Ubuntu server

Just set your configuration path. Examples :

  • /etc/netplan/50-cloud-init.yaml
  • /etc/resolv.conf