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 / 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 / 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 / HowToManageUsersInLinux.md
Last active June 23, 2017 10:34
Some notes for easy user management on Linux

How To Manage Users In Linux

Enable root account

sudo passwd

Disable root account

sudo passwd -l root

Add a new user

adduser

@mansouryaacoubi
mansouryaacoubi / sethostname.sh
Last active June 22, 2017 14:52
Easy script to set hostname in Linux
#!/bin/bash
# @discription Installation script for lamp
# @author Mansour Yaacoubi
# @filename sethostname.sh
# @todos add better documentation, add support for other distributions
curhostname=$(hostname)
newhostname=$1
################# CHECK WHETHER SCRIPT IS RUNNING AS ROOT #################
# Run script as root to be able to install software like
@mansouryaacoubi
mansouryaacoubi / install-lamp.sh
Last active June 22, 2017 20:42
Install LAMP on Linux Systems (Apache, MySQL, PHP)
#!/bin/bash
# @discription Installation script for lamp
# @author Mansour Yaacoubi
# @filename install-lamp.sh
# @todos add better documentation, add support for other distributions,
# create light-version of this tool
#
# Copyright 2017 myblog
#
# Licensed under the Apache License, Version 2.0 (the "License");
@mansouryaacoubi
mansouryaacoubi / SublimeText3ContextMenuAdd.bat
Last active July 3, 2017 00:51
Add a Context Menu Item for Sublime Text 3 to your Windows Context Menu (Open File and Folders)
@echo off
net session >nul 2>&1
IF ERRORLEVEL 1 GOTO ERROR
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
REM add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
@mansouryaacoubi
mansouryaacoubi / HowToFindActiveDirectoryAddress.md
Last active June 21, 2017 23:59
How to find out Active Directory IP - LDAP AD

Start -> Run -> nslookup

set type=all

_ldap._tcp.dc._msdcs.yaacoubi.com

@mansouryaacoubi
mansouryaacoubi / setbg.sh
Last active August 10, 2018 07:47
Easy setup for Ubuntu background image (installation using /bin) [recommended]
#!/bin/bash
# @author Mansour Yaacoubi
# @filename setbg.sh
# @version 2.3
# @task Sets background in Ubuntu and some other Linux versions
# @feature When this script runs as superuser,
# the command 'setbg' can be installed into /bin directory
# @timestamp 15:53 12.06.2017
# @usage ./setbg.sh wallpaper.jpg
# su $USER -c setbg.sh wallpaper.jpg
@mansouryaacoubi
mansouryaacoubi / HowToInstallWin89.md
Last active June 8, 2017 08:03
Note to myself in case Win89 is not installing in VirtualBox

Installation

  • use ISO-image in VirtualBox, burn on Disc or flash on USB-drive
  • boot into image
  • if installation not possible because MS-DOS Startpartition is not available
  • fdisk > Y > 4 (List all partitions)
  • Delete all available partitions
  • Go back to menu
  • 1 > Y (Create new partition)
  • Windows 89 should be installing now
@mansouryaacoubi
mansouryaacoubi / GetProductKey.bat
Last active June 12, 2017 10:12
Get Windows Product Key via PowerShell, Registry and WMI
@echo off
powershell "Import-Module %~dp0GetProductKey.ps1; Get-WindowsKey"