Skip to content

Instantly share code, notes, and snippets.

View codenathan's full-sized avatar

Sakees Nathan codenathan

View GitHub Profile
@codenathan
codenathan / Multiple_PHP_Versions.md
Created September 9, 2023 17:24
Run Multiple Version of PHP using Laravel Valet on Mac

Note Laravel Valet is only for MacOS

  • Install the latest version of Laravel Valet by following the documentation
  • Go into your individual projects and run valet isolate php@<phpversion> i.e. valet isolate 7.4
  • To Run Artistan commands use valet php artisan
  • To Run Composer use valet composer
@codenathan
codenathan / GIT_Remove_File_From_Commit_History.md
Created September 8, 2023 12:12
Remove File From Git Commit History

Git provides a native way to remove a file from the entire commit history

Make sure you backup your repository before attempting this.

Use the git filter-branch command to remove the file from all commits in your repository history.

Replace <file_path> with the actual file path and name from the root of your project:

git filter-branch --force --tree-filter 'rm -f ' --prune-empty -- --all
@codenathan
codenathan / Dnsmasq.md
Created September 6, 2023 21:25
CUSTOM Dnsmasq Configuration for MAC

Custom Dnsmsq Config on MAC

Add Additional Config File

Open the dnsmasq configuration file by running the following command in your terminal:

sudo nano /usr/local/etc/dnsmasq.conf
@codenathan
codenathan / MaterialDarkCustom.itermcolors
Created September 6, 2023 20:24
Iterm 2 Colour Scheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.21960784494876862</real>

Prerequisites

  • Install Git either via Homebrew using brew install git or download the binary installerr https://git-scm.com/

Generate SSH

Open Bash and run following commands

Sometimes the .ssh folder may not get created

How to start a GoLang Project

This will guide you on how setup a go lang project through terminal. with Go you can now start your project inside any folder.

there a several steps you need to do.

Here are the step

@codenathan
codenathan / reset_windows_10_admin_password.bat
Created July 22, 2021 11:35
Reset Windows 10 Local Admin Password with Command Prompt
#Take a backup copy of utilman.exe
copy c:\windows\system32\utilman.exe c:\windows\system32\utilman_bak.exe
#Copy to Utilman
copy c:\windows\system32\cmd.exe c:\windows\system32\utilman.exe
@codenathan
codenathan / create_admin_user_using_cmd.bat
Created July 22, 2021 11:33
Create an Admin User Account Using CMD Prompt
# Create The User
net user /add [*username] [password]
#e.g. net user /add codenathan
# Add User To Administrator Group
net localgroup administrators [username] /add
@codenathan
codenathan / wpcf7_validate_textarea.php
Last active July 22, 2021 11:30
Worpress Contact Form 7 - Textarea Validation - Your Message
add_filter( 'wpcf7_validate_textarea', 'no_urls_allowed', 10, 3 );
add_filter( 'wpcf7_validate_textarea*', 'no_urls_allowed', 10, 3 );
function no_urls_allowed( $result, $tag ) {
$tag = new WPCF7_Shortcode( $tag );
$type = $tag->type;
$name = $tag->name;
@codenathan
codenathan / moving_wordpress_website_mysql_command.sql
Created July 22, 2021 11:26
Wordpress - Move From Old Site To New Site Mysql Commands
/*
A simple command for updating wordpress urls when moving websites
*/
/* REPLACE THE THREE BELOW @prefix (if different from default) , @oldurl , @newurl */
SET @prefix = "wp";
SET @oldurl = "http://oldurl";
SET @newurl = 'http://newurl';