Skip to content

Instantly share code, notes, and snippets.

View smarteist's full-sized avatar
🙂
I may be slow to respond.

Ali Hosseini smarteist

🙂
I may be slow to respond.
View GitHub Profile
@smarteist
smarteist / vim_tmux.md
Last active April 11, 2024 13:19
Starting With VIM & TMUX

VIM

Quit VIM!

:q + ENTER

Force Quit VIM!

:q! + ENTER

@smarteist
smarteist / relax-supplier-parts.txt
Last active March 24, 2024 20:38
This is relax relational algebra calculator example data
group: SUPPLIER PARTS - S, SP, P
description: This is a very simple database that is used by ChrisDate & HughDarwen throughout their books (e.g., AnIntroductionToDatabaseSystems & TheThirdManifesto) for examples.
P = {
pn, pname, color
1, 'PN1', 'Red'
2, 'PN2', 'Blue'
3, 'PN3', 'Yellow'
4, 'PN4', 'Green'
@smarteist
smarteist / sql-cheatsheet.md
Last active March 20, 2024 08:49
SQL cheat sheet

SQL languages

DDL is short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.

DCL is short name of Data Control Language which includes commands such as GRANT, and mostly concerned with rights, permissions and other controls of the database system.

DML is short name of Data Manipulation Language which deals with data manipulation, and includes most common SQL statements such INSERT, UPDATE, DELETE etc, and it is used to store, modify, delete and update data in database.

DQL is short name of Data Query Language which used for performing queries on the data within schema objects. The purpose of the DQL Command is to get some schema relation based on the query passed to it. SELECT statement is used to retrieve data from the database.

@smarteist
smarteist / downloader.sh
Created February 2, 2024 13:13
bash downloader via curl
#!/bin/bash
# Define the list of URLs
urls=(
"https://.mkv"
"https://.mkv"
)
# Define the resumable downloader function
download_file() {
#!/usr/bin/env bash
cpucores="2"
ram="2G"
disk="30G"
username="vm"
password="111111"
vm_name="VM1"
ver="22.04"
img="ubuntu-${ver}-server-cloudimg-amd64.img"
@smarteist
smarteist / sshproxy.sh
Created October 20, 2023 21:41
This script runs ssh proxy in local socks5 port 1080
#!/bin/bash -i
user_at_host="root@<host>"
sudo_pass="password!";
sudo_pass_file="/tmp/sshpass"
interfaces_arr=($(ip route show default | sed -n 's/.* dev \([^\ ]*\) .*src.*/\1/p'))
for i in "${interfaces_arr[@]}"; do
# Activate debugging from here

In Linux, groups are a collection of users. They are used as a means to manage and control access to resources such as files and directories. By assigning appropriate permissions to groups rather than individual users, system administrators can more efficiently manage access rights.

find /path/to/base/dir -type d | xargs chmod 755
find /path/to/base/dir -type f | xargs chmod 644

or changing files with specific extention:

find /path/to/base/dir -iname "*.php" | xargs chmod 644
@smarteist
smarteist / git essential commands.md
Last active September 17, 2023 11:53
git essential commands
current git version
git --version
git global user config
@smarteist
smarteist / symfony.conf
Created August 1, 2023 16:56
nginx confings for symfony2
# -------------------
# SYMFONY CONF
# -------------------
server {
listen 443 ssl http2;
listen 80;
server_name domain.com www.domain.com;
charset utf-8;
root "/var/www/domain/public_html";
gzip off;
@smarteist
smarteist / ln.py
Last active June 17, 2023 15:15
CORDIC Algorithm to calc natural logarithm in python
import math
def cordic_ln(x):
if x <= 0:
raise ValueError("Input must be greater than 0")
lut = [
2.718281828459045,
1.6487212707001282,
1.2840254166877414,