Skip to content

Instantly share code, notes, and snippets.

View azer-tab's full-sized avatar

Azer Taboubi azer-tab

View GitHub Profile
@azer-tab
azer-tab / brightnessDown.txt
Last active May 8, 2022 10:25
Adjusting screen brightness on Linux Mint Mate
#!/bin/bash
B=$(xrandr --verbose | awk '/Brightness/ { print $2; exit }')
A=0.2
C=$(echo "$B - $A" | bc)
M=$(xrandr | grep " connected" | cut -f1 -d " ")
xrandr --output $M --brightness $C
@azer-tab
azer-tab / inputdata.json
Last active June 5, 2022 11:02
Recursively manipulate mock json server
[
{
"id": 0,
"title": "1",
"sublist": [
{
"id": 1,
"title": "1.1",
"sublist": [
{
@azer-tab
azer-tab / main.ts
Last active June 5, 2022 11:02
Resizable image importation, in ReactJS using material ui components.
<Box
component="img"
sx={{
height: 233,
width: 350,
maxHeight: { xs: 233, md: 167 },
maxWidth: { xs: 350, md: 250 },
}}
alt="The house from the offer."
src="https://images.unsplash.com/photo-1512917774080-9991f1c4c750?auto=format&w=350&dpr=2"
@azer-tab
azer-tab / sh
Last active July 4, 2022 14:34
Command for Modifying path with fish shell
set -U fish_user_paths $HOME/.composer/vendor/bin
@azer-tab
azer-tab / Headphone Jack problem with Ubuntu
Last active August 30, 2022 13:53
Issues like headphone jack not working push people to avoid using Ubuntu. My headphones microphone was detected by the os but not transmitting my voice during the online calls. The following simple steps were enough to solve the issue,
make sure you exit any running programs that are using your microphone. sudo alsa force-reload
open pavucontrol or any volume control tool of yours
change the option "Headphones (unplugged)"
you might have to restart your computer
@azer-tab
azer-tab / redshift configuration for all day night mode
Last active August 30, 2022 13:55
redshift.conf - configuration file for redshift and gtk-redshift (works fine for me with Linux Mint Mate) with Tromsø, Norway Lon and Lat parameter, 3500k date and night screen temperatures. You pick your city's coordinates from http://www.geonames.org/.
; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=3500
temp-night=3500
; Disable the smooth fade between temperatures when Redshift starts and stops.
; 0 will cause an immediate change between screen temperatures.
; 1 will gradually apply the new screen temperature over a couple of seconds.
fade=1
@azer-tab
azer-tab / dockerwithoutsudo.md
Created March 9, 2023 17:49
Run Docker commands without sudo

Run Docker commands without sudo

  1. Add the docker group if it doesn't already exist

$ sudo groupadd docker

  1. Add the connected user $USER to the docker group

Optionally change the username to match your preferred user.

$ sudo gpasswd -a $USER docker

@azer-tab
azer-tab / sPhpStorm.sh
Last active March 26, 2023 12:58
Run phpstorm as sudo so you can edit all the project files. Make sure to add the permission to execute to the file by running this command : $ chmod +x sPhpStorm.sh
#!/bin/bash
# Find the path to PhpStorm
phpstorm_path=$(find / -name "phpstorm.sh" 2>/dev/null | head -n 1)
# Check if PhpStorm was found
if [[ -z "$phpstorm_path" ]]; then
echo "PhpStorm not found"
exit 1
fi
@azer-tab
azer-tab / portainer.md
Last active March 26, 2023 13:14
Portainer is a good alternative for docker desktop when working under Linux. Here is a small descriptive on how to get it ready to run on your machine.

This command runs a Docker container named "portainer" based on the "portainer/portainer-ce:latest" Docker image.

docker run -d -p 66666:8000 -p 66667:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

1. The "-d" flag

starts the container in the background. The "-p" flag binds two container ports (8000 and 9000) to two host ports (66666 and 66667) respectively, allowing access to the portainer web interface from outside the container.

2. The "--name" flag

sets the name of the container as "portainer". The "--restart" flag ensures that the container is always restarted automatically if it stops or if the Docker daemon is restarted.

@azer-tab
azer-tab / Decorator.php
Last active April 8, 2023 14:45
This is an example of decorator pattern usage written in php. We tried to add functionalities costs and descriptions dynamically without breaking the open-closed principle and modifying the basic inspection class.
<?php
interface CarService
{
public function getCost();
public function getDescription();
}