Skip to content

Instantly share code, notes, and snippets.

View mansouryaacoubi's full-sized avatar
🥑
FR E SH A VOCA DO

Mansour Yaacoubi mansouryaacoubi

🥑
FR E SH A VOCA DO
View GitHub Profile
@mansouryaacoubi
mansouryaacoubi / checkhost.bat
Last active July 18, 2017 12:21
Continuous host reachability check (Batch on Windows using Ping)
@echo off
set url=%1
mode con cols=70 lines=1
color 37
::color 17
:check
IF %url%. EQU . (
set /P url=Host:
goto check
)
@mansouryaacoubi
mansouryaacoubi / diskpart-batch.txt
Created June 26, 2017 13:51
Diskpart clean disk and create new partitions
LIST DISK
SELECT DISK 1
CLEAN
CLEAN
CREATE PART PRI
SELECT PART 1
ACTIVE
ASSIGN
FORMAT FS=NTFS QUICK
EXIT
@mansouryaacoubi
mansouryaacoubi / raspi_setup.md
Last active September 10, 2017 04:42
Steps to Setup Raspi

Steps to Setup Raspi

Default user: pi Default pass: raspberry

  • #00 Login as pi
  • #01 sudo passwd
  • #02 exit
  • #03 Login as root with preset password
  • #04 adduser mansour
  • #05 adduser mansour sudo
@mansouryaacoubi
mansouryaacoubi / install_rndis.md
Last active September 10, 2017 00:19
Install RNDIS driver on Acer Laptop

Install RNDIS driver on Acer Laptop

Steps

  • Download the correct *.cab file from: Microsoft Update
  • Extract *.cab file
  • Execute pnputil -i -a RNDIS.inf with higher privileges
@mansouryaacoubi
mansouryaacoubi / enable_rpi_otg.py
Last active September 10, 2017 23:39
Easy python-script to enable Raspberry Pi OTG Ethernet/SSH over USB (dwc2, g_ether)
# @author Mansour Yaacoubi
# @filename enable_rpi_otg.py
# @task Enable ssh over USB for Raspberry Pi
#
# Install pywin32 for this (https://sourceforge.net/projects/pywin32/files/pywin32/)
import win32api, pywintypes
import requests
from time import sleep
@mansouryaacoubi
mansouryaacoubi / cleanformatdisk.bat
Last active September 10, 2017 19:30
Clean disk, create primary partition and format disk with diskpart using Batch
REM @author Mansour Yaacoubi
REM @filename cleanformatdisk.bat
REM @task Cleans disk, creates primary partition and formats disk
REM f.e. for raspberry pi drives before writing new image of SD-Card
@echo off
cls
net session >nul 2>&1
IF %ERRORLEVEL% == 0 GOTO START
echo Please run this batch as administrator
@mansouryaacoubi
mansouryaacoubi / addwifi.sh
Last active June 17, 2022 08:27
Adds wifi to the wpa_supplicant file and reconfigures wpa_cli (Raspberry Pi Wifi)
#!/bin/bash
# @author Mansour Yaacoubi
# @filename addwifi.sh
# @usage sudo ./addwifi.sh "SSID" "WPA-Key"
# @task adds wifi to the wpa_supplicant file and reconfigures wpa_cli
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit 1
else
@mansouryaacoubi
mansouryaacoubi / update-rpi.sh
Last active April 20, 2020 14:48
Updates and upgrades system and Raspberry Pi and installs specific programs and modules
#!/bin/bash
# @author Mansour Yaacoubi
# @filename update-rpi.sh
# @task Installs new updates and specific programs
################# CHECK WHETHER SCRIPT IS RUNNING AS ROOT #################
# Run script as root (higher privileges)
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit 1
@mansouryaacoubi
mansouryaacoubi / dl-tools.sh
Last active September 10, 2017 16:32
Download Raspberry Pi Tools (update, setup, wifi, etc...)
#!/bin/bash
# @usage bash <(curl -s https://gist.githubusercontent.com/mansouryaacoubi/0582fe108f699956c677b95e24c71e9a/raw/73c7ce97257eb76a4d2c3a1b4c7243f8efdf0355/dl-tools.sh)
cd ~
echo "download .bash_aliases"
wget https://gist.githubusercontent.com/mansouryaacoubi/e3454417d57858dec9273e5503132670/raw/81f0e701d9114e9a8bd6fc94a71f0d7499acb884/.bash_aliases >/dev/null 2>&1
echo " create directory tools"
mkdir tools
echo " change directory"
@mansouryaacoubi
mansouryaacoubi / .bash_aliases
Last active February 23, 2020 11:57
Default bash aliases for Raspberry Pi
alias cls=clear
alias c=clear
alias x=exit
alias l='ls -lisah'
alias ld='du -h | sort -nr | head -n 10' # large directories