Skip to content

Instantly share code, notes, and snippets.

View pka246's full-sized avatar

Kisan Patel pka246

View GitHub Profile
@pka246
pka246 / index.cmd
Created August 30, 2025 07:47
Azure Container App Create Through CLI
az containerapp up -n worldtripinfo --environment worldtrip-environment --source . --image <ACR_NAME>.azurecr.io/wordtripinfo:1.0.0 --registry-server <ACR_NAME>.azurecr.io -g worldtrip-rg --registry-username=<ACR_NAME> --registry-password=<ACR_PASSWORD>
@pka246
pka246 / data.service.ts
Last active April 9, 2024 04:09
Angular 17+ Implementation of Toastr using Bootstrap 5
import { Injectable, inject } from '@angular/core';
import { ToastService } from './toast.service';
@Injectable({
providedIn: 'root',
})
export class DataService {
toastService = inject(ToastService);
error(error: string) {
@pka246
pka246 / rx-dropdown-toggle.directive.ts
Created April 9, 2024 04:06
Angular 17+ Directive for Dropdown using Bootstrap 5
import { Directive, ElementRef, HostListener } from '@angular/core';
import { Dropdown } from 'bootstrap';
@Directive({
selector: '[rxBsDropdownToggle]',
standalone: true
})
export class RxDropdownToggleDirective {
constructor(private el: ElementRef) { }
@pka246
pka246 / login.component.html
Created April 9, 2024 04:04
Angular 17+ ReactiveForm Validation Directive for Bootstrap 5
<div class="form-group mb-3">
<label class="form-label" for="password">Password</label>
<input type="password" autocomplete="new-password" name="password" class="form-control"
formControlName="password" id="password" placeholder="********" appRxValidation>
</div>
@pka246
pka246 / script.js
Created August 10, 2023 05:12
Script to download files in HTML page
validExtensions = ['jpg', 'png', 'jpeg', 'pdf', 'xlsx', 'docx', 'doc']
var download = (url, filename) => {
const link = document.createElement('a')
link.setAttribute('href', url);
link.setAttribute('download', filename);
link.style.display = 'none';
document.body.appendChild(link);
@pka246
pka246 / index.txt
Created August 9, 2023 17:19
Git: To edit a commit Message other than the most recent
To edit a commit other than the most recent:
Step1: git rebase -i HEAD~n to do interactive rebase for the last n commits affected. (i.e. if you want to change a commit message 3 commits back, do git rebase -i HEAD~3)
git will pop up an editor to handle those commits, notice this command:
# r, reword = use commit, but edit the commit message
that is exactly we need!
Step2: Change pick to r for those commits that you want to update the message. Don't bother changing the commit message here, it will be ignored. You'll do that on the next step. Save and close the editor.
@pka246
pka246 / index.txt
Created June 8, 2023 14:57
Change password of mysql database user in Linux
mysql -h localhost -u username -p database_name
SET PASSWORD = PASSWORD('RANDOM_PASS');
@pka246
pka246 / index.md
Created April 26, 2023 16:55
scp file transfer with SSH key

SSH login:

ssh -i key.pem user-name@public-dns or ip-address To send a file from Window to remote (like AWS ec2):

scp -i key.pem file.txt user-name@public-dns:~/ To send a directory from Window to remote:

scp -i key.pem -r directory_name user-name@public-dns:~/ To receive a file from remote to Window:

@pka246
pka246 / index.sh
Created April 24, 2023 09:50
Java - keytool
keytool -import -noprompt -trustcacerts -alias *.example.com -file "D:\Example\Docs\cert\example.crt" -keystore cacerts
# get list of certificates
keytool -list -keystore "C:\Program Files\Java\jdk-20\lib\security\cacerts"
# import certificates
keytool -import -noprompt -trustcacerts -alias mobileapp.example.com -file D:/MoneyMailer/Docs/cert/example.com.pem -keystore "C:\Program Files\Java\jdk-20\lib\security\cacerts"
@pka246
pka246 / .htaccess
Created April 1, 2023 12:46
Wordpress - Add Expire Headers
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/html "access plus 3 days"
ExpiresByType text/xml "access plus 1 seconds"
ExpiresByType text/plain "access plus 1 seconds"