Skip to content

Instantly share code, notes, and snippets.

View alaztetik's full-sized avatar
😁
Happy developer

Alaz Tetik alaztetik

😁
Happy developer
View GitHub Profile
@alaztetik
alaztetik / postgresql.sh
Created May 8, 2021 08:14
PostgreSQL install and start-up on Linux
sudo pacman -Sy postgresql
sudo -u postgres -i initdb /var/lib/postgres/data
sudo systemctl start postgresql && sudo systemctl status postgresql
sudo systemctl enable postgresql
sudo su - postgres
psql
# SQL commands
exit
@alaztetik
alaztetik / alias_for_jvm.sh
Created May 25, 2021 05:53
Multiple JVMs on one machine
# add following lines to the .bashrc file
alias java11='/usr/lib/jvm/java-11-openjdk/bin/java'
alias javac11='/usr/lib/jvm/java-11-openjdk/bin/javac'
alias java16='/usr/lib/jvm/jdk-16.0.1/bin/java'
alias javac16='/usr/lib/jvm/jdk-16.0.1/bin/javac'
alias jshell16='/usr/lib/jvm/jdk-16.0.1/bin/jshell'
@alaztetik
alaztetik / create_folders.py
Created December 4, 2021 11:33
Creates folders with fixed prefix and incremental numbers at the end
import os
def create_folders(num, prefix=''):
"""Creates specified numbers of folders with a prefix in front of each"""
for num in range(1, num+1):
if not os.path.exists(f"{prefix}{str(num)}"):
os.makedirs(f"{prefix}{str(num)}")
@alaztetik
alaztetik / docker-on-manjaro.sh
Last active February 24, 2022 19:17
Docker on Manjaro Linux
# make packages up to date
sudo pacman -Syu
# install Docker
sudo pacman -S docker
# start Docker service
sudo systemctl start docker.service
# stop Docker service
@alaztetik
alaztetik / mariadb-setup-on-manjaro.md
Created May 16, 2022 19:41
This code shows how to manage a local MariaDB server on local

Setup for MariaDB / MySQL on Manjaro Linux

Follow these steps for a PHP-MariaDB project:

sudo pacman -S php mariadb mariadb-clients mariadb-libs
sudo mariadb-install-db
sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
sudo systemctl status mariadb.service
@alaztetik
alaztetik / mongodb-on-linux.md
Created June 6, 2022 20:01
How to run mongod (server) and mongo/mongos shell on Linux
# start the server:
mongod --dbpath /path/to/data/to/be/stored --logpath /log/path/mongo.log

# enter the shell:
mongo
# or
mongos
@alaztetik
alaztetik / root-finding.go
Created June 8, 2022 11:40
Newton–Raphson root finding method
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(1)
s := float64(0)
@alaztetik
alaztetik / linux_distribution_info.md
Created June 19, 2022 21:35
GNU/Linux distribution and release information command

Show GNU/Linux distribution information:

lsb_release -drc

prints e.g.:

Description:	Manjaro Linux
@alaztetik
alaztetik / manjaro_aur_pamac_update.md
Created July 22, 2022 23:34
pamac update problem with google-chrome solved with this command

google-chrome update problem solved by:

sudo pamac update --aur --devel

command and updated it from version 101~ to 103~

@alaztetik
alaztetik / mongodb_on_docker.sh
Last active November 20, 2022 12:18
Run and connect to MongoDB on Docker locally
# commands may need sudo
# pull MongoDB image:
docker pull mongo
# start container:
docker run -d \
--name CONTAINER_NAME \
-p LOCALHOST_PORT_NUMBER \
-e MONGO_INITDB_ROOT_USERNAME=username \