Skip to content

Instantly share code, notes, and snippets.

View NaserKhoshfetrat's full-sized avatar

Naser Khoshfetrat NaserKhoshfetrat

View GitHub Profile
#login as superuser into postgres super user
.\psql.exe -u postgres
#show all database
\l
#change the current database to the one that you want to show tables:
\c testDb
# command from the PostgreSQL command prompt to show tables in the selected database:
#check sign version v1 and v2
java -jar .\apksigner.jar verify --verbose --print-certs .\test-app.apk
#check sign version v1, v2, v3, v4 which set by enableV3Signing, enableV4Signing
java -jar .\apksigner.jar verify -v -v4-signature-file .\test-app.apk.idsig .\test-app.apk
@NaserKhoshfetrat
NaserKhoshfetrat / linux.sh
Last active January 7, 2023 12:15
linux command sheet
#######################################################################################################
##os-centos-7##
#get centos version
$cat /etc/centos-release
#get system info
$hostnamectl
#get kernel
@NaserKhoshfetrat
NaserKhoshfetrat / snippet.sql
Created September 14, 2022 15:43
sqlserver snippet
SWITCHOFFSET(CONVERT(datetimeoffset, [CreatedAt]), DATENAME(TzOffset, SYSDATETIMEOFFSET()))
git clean -xdf --dry-run //to remove absolutely every file on the .gitignore list
dotnet new gitignore //touch .gitignore
@NaserKhoshfetrat
NaserKhoshfetrat / performance.sql
Created June 10, 2022 11:17
sql server procedure performance
-- sys.dm_os_performance_counters is a system Dynamic Management View (DMV) that returns one row for each SQL Server performance counter. It's useful for obtaining information about current performance counter values.
declare @cntr_value bigint
Select @cntr_value=cntr_value
from sys.dm_os_performance_counters
where instance_name='Fabrics' and
counter_name='Write Transactions/sec'
waitfor delay '00:00:01'
Select cntr_value -@cntr_value
@NaserKhoshfetrat
NaserKhoshfetrat / TableSpaceUsed.sql
Last active June 10, 2022 10:05
sql server procedure TableSpaceUsed
--<sys.sp_MSforeachtable>: execute sp_spaceused for all of database table
--<sp_spaceused>: return rows, index size and data size of table
EXEC sys.sp_MSforeachtable 'sp_spaceused ''?''';
--or as table
USE [Fabrics]
GO
CREATE TABLE #TableSpaceUsed(
[name] [nvarchar](120) NULL,
[rows] [nvarchar](120) NULL,
@NaserKhoshfetrat
NaserKhoshfetrat / fabrics.sql
Created June 9, 2022 07:34
sqlserver dummy database
-- Fabrics V1.2
-- Creating a SQL database from scratch
USE Fabrics
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_Fabrics]') AND type in (N'P', N'PC'))
DROP PROCEDURE usp_Fabrics
GO
CREATE PROCEDURE [dbo].usp_Fabrics
(@CreateClients INT = 2500,
@CreateOrders INT = 5000)
@NaserKhoshfetrat
NaserKhoshfetrat / ssl.sh
Last active April 26, 2022 08:37
get publick key
openssl s_client -servername HOSTURL -connect mydomain.com:443 | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
openssl x509 -in ~/Downloads/certi_pem.cer -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
openssl s_client -servername HOSTURL -connect myhost.com:443 | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | hexdump -v -e '/1 "%02x"'
@NaserKhoshfetrat
NaserKhoshfetrat / adb.txt
Created March 11, 2022 21:46
adb command
//install
adb install package.name.apk
//uninstall
adb uninstall package.name
//proces id
adb shell pidof package.name
//debug