Skip to content

Instantly share code, notes, and snippets.

View Max95Cohen's full-sized avatar

Max Cohen Max95Cohen

View GitHub Profile
@Max95Cohen
Max95Cohen / bash.sh
Created August 28, 2024 08:49
Create partition
# create new partition
sudo fdisk /dev/sda
# in fdisk console
n - add a new partition
p - print the partition table
w - write table to disk and exit
q - quit without save changes
# make file system
@Max95Cohen
Max95Cohen / wget
Created August 28, 2024 08:48
wget examples
# download from web-site
wget https://example.com/file.zip
# continue from interrupt
wget -c https://example.com/file.zip
# new file name
wget -O newname.zip https://example.com/file.zip
# new path
@Max95Cohen
Max95Cohen / cURL
Created August 28, 2024 08:48
CURL example
# save to file
curl -O https://example.com/file.zip
# new file name
curl -o newname.zip https://example.com/file.zip
@Max95Cohen
Max95Cohen / mdadm
Last active September 2, 2024 16:06
Create RAID from two disk
Create the RAID: Use the command
```bash
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc
```
to create a RAID 1 with two disks. This combines two disks (/dev/sdb and /dev/sdc)
into a virtual device named "/dev/md0".
```
@Max95Cohen
Max95Cohen / exercise-errors.go
Created September 29, 2023 13:54
A tour of Go Exercise: Errors
package main
import (
"fmt"
"math"
)
type ErrNegativeSqrt float64
func (e ErrNegativeSqrt) Error() string {
@Max95Cohen
Max95Cohen / bash
Last active February 26, 2024 03:59
bash files
#!/bin/sh
nocolor='33[0m';
color0='33[0;30m';
color1='33[0;31m';
color2='33[0;32m';
color3='33[0;33m';
color4='33[0;34m';
color5='33[0;35m';
color6='33[0;36m';
color7='33[0;37m';
@Max95Cohen
Max95Cohen / VFS
Last active October 3, 2023 16:14
Kernel Panic - not syncing: VFS: Unable to mount root fs on
https://askubuntu.com/questions/895492/kernel-panic-vfs-cannot-open-root-device-or-unknown-block-error-6
sudo update-initramfs -u -k $(uname -r)
https://askubuntu.com/questions/41930/kernel-panic-not-syncing-vfs-unable-to-mount-root-fs-on-unknown-block0-0
sudo fdisk -l
sudo mount /dev/sda2 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
@Max95Cohen
Max95Cohen / phpmyadmin
Last active December 14, 2023 04:22
phpmyadmin bash script
echo '.list_container.hide{margin-bottom:50px !important}' >> themes/original/css/theme.css
sed -i 's/#pma_navigation{background:#fff;/#pma_navigation{background:#d00;/g' themes/original/css/theme.css
sed -i 's/#pma_navigation_tree li.selected{color:#000;background-color:#eee}/#pma_navigation_tree li.selected{color:#000;background-color:#b00}/g' themes/original/css/theme.css
sed -i 's/body{font-family:sans-serif;/body{font-family:Ubuntu,sans-serif;/' themes/original/css/theme.css
sed -i '5,9d' templates/login/header.twig
@Max95Cohen
Max95Cohen / .bashrc
Last active July 16, 2024 03:12
.bashrc doker-compose bash script
alias compose-ps="docker ps --format 'table {{ .Names }}\t{{ .Status }}\t{{ .Label \"com.docker.compose.project\" }}\t{{ .Label \"com.docker.compose.service\" }}\t{{ .Label \"com.docker.compose.project.working_dir\" }}'"
alias dps="docker ps -a --format 'ID: {{.ID}}\nNames: {{.Names}}\nProject: {{.Label \"com.docker.compose.project\"}}\nPorts: {{.Ports}}\nStatus: {{.Status}}\n'"
dc() {
project=$1
container=$2
check=echo $project | grep "laravel"
if [ -z $check ]; then
@Max95Cohen
Max95Cohen / ufw.conf
Last active May 15, 2024 07:23
ufw config
IPV6=no
ufw allow 11200:11299/tcp