This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Windows IP Config | |
ipconfig | |
Get-NetIPAddress -AddressFamily IPV4 -InterfaceAlias Wi-Fi | Select IPAddress | |
# When you want to download a list of files in files.txt having header as `sources,` | |
Import-Csv .\files.txt | Start-BitsTransfer | |
# Ping equivalent in PS | |
Test-Connection -ComputerName (hostname) -Count 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Expo (for easy creation, bundling and maintenance of project for cross-platform) | |
npm i -g expo-cli | |
# Getting dirty with Expo | |
expo --help # to see commands list | |
expo register # to sign-up with the site | |
expo login | |
expo logout | |
expo login | |
expo whoami |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To get Env Variables available in Powershell | |
Get-ChildItem -Path Env:\ | |
# To get host IP. See value for IPv4Address | |
Get-NetIPConfiguration | |
# Show Current Firewall Settings | |
netsh interface portproxy show v4tov4 | |
# Reset/Clear All Firewall Settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 1 : Take backup of current apache2 installation directory | |
sudo cp -r /etc/apache2 /etc/apache2_bkup | |
# Step 2 : Stop Apache2 | |
sudo service apache2 stop | |
# Step 3 : Upgrade Apache2 | |
# Warning: When prompted by the upgrade script asking if you would like to replace the existing config file with newer one, say NO!. | |
# If you in a hurry select yes, don't forget to replace it with one from the backup you took in step 1. | |
sudo apt update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get usage statistics on Index using DMVs in SQL Server | |
// Reference: https://www.sqlshack.com/gathering-sql-server-indexes-statistics-and-usage-information/ | |
SELECT OBJECT_NAME(IX.OBJECT_ID) Table_Name | |
,IX.name AS Index_Name | |
,IX.type_desc Index_Type | |
,SUM(PS.[used_page_count]) * 8 IndexSizeKB | |
,IXUS.user_seeks AS NumOfSeeks | |
,IXUS.user_scans AS NumOfScans | |
,IXUS.user_lookups AS NumOfLookups |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This one is bash, bcoz bcp is a cmd line utility | |
# https://docs.microsoft.com/en-us/sql/tools/bcp-utility?view=sql-server-ver15#examples | |
# WideWorldImporters can be downloaded from https://github.com/Microsoft/sql-server-samples/releases/tag/wide-world-importers-v1.0 | |
bcp WideWorldImporters.Warehouse.StockItemTransactions out D:\BCP\StockItemTransactions_character.bcp -c -T | |
# Bulk Insert | |
BULK INSERT YourTargetTable FROM '\\shared\directory\sourcedata.txt'; | |
BULK INSERT Sales.Invoices | |
FROM 'inv-2017-12-08.csv' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR ALTER FUNCTION dbo.AgeStatus | |
( | |
@AGE INT | |
) | |
RETURNS CHAR(10) | |
AS | |
BEGIN | |
DECLARE @status CHAR(5); | |
IF @AGE < 18 | |
SET @category = 'MINOR'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION CUBE(@X INT) | |
RETURNS INT | |
AS | |
BEGIN | |
RETURN @X * @X *@X | |
END | |
/* | |
To execute the above function call it like below | |
SELECT dbo.CUBE(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- DB to use | |
use Puzzles; | |
-- Remove the Table and the SP if it already exists | |
drop table dbo.generated_table; | |
drop procedure dbo.addRows; | |
-- Define the Table to be populated with generated data | |
CREATE TABLE dbo.generated_table ( | |
id int --PRIMARY KEY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem -Recurse | Select-String -Pattern 'abc' -List | Select-String -Pattern 'pqr' -List | | Select-String -Pattern 'xyz' -List | Select Path | |
# With pipes '|', we are filtering the result set with additional search terms thus acing like the search for terms are AND conditional. |
NewerOlder