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 / LEARN-2.md
Last active December 19, 2023 23:52
Make Git Repository From Existing Directory
  • Create Repository in github.com
  • Go into the directory containing the project.
  • Type git init
  • Type git add . to add all of the relevant files.
  • Type git commit
  • Type git remote add origin https://github.com/<username>/<repo-name>
  • Type git config --global push.default simple
  • Type git branch --set-upstream-to=origin/master
  • Type git push
@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."
@hatamiarash7
hatamiarash7 / commands.md
Last active June 9, 2022 03:23
CentOS + Apache + Django + WSGI + CWP + Python3.6
  • yum install python36u python36u-devel python36u-mod_wsgi
  • alias python='/usr/bin/python3.6'
  • curl -O https://bootstrap.pypa.io/get-pip.py
  • python get-pip.py
  • python -m pip install django mysqlclient
  • cp /etc/httpd/modules/mod_wsgi_python3.6.so /usr/local/apache/modules
  • create/clone/move project to another location ( not /home/user/public_html ) because there is not any access to top level directories
  • config apache
  • make & config database ( project/settings.py )
  • convert charset ALTER TABLE table CONVERT TO CHARACTER SET utf8;
==> 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: