Skip to content

Instantly share code, notes, and snippets.

@tareq2
tareq2 / select_with_columns_name.sql
Created October 20, 2024 12:07
Make select for all tables in sql server and split the output without truncating the output.
--make sure to increase the text output from options
DECLARE @sql NVARCHAR(MAX) = '';
-- Build the dynamic SQL query
SELECT @sql = @sql +
'SELECT TOP 0 ' + STUFF((SELECT ', ' + QUOTENAME(COLUMN_NAME)
FROM INFORMATION_SCHEMA.COLUMNS AS c
WHERE c.TABLE_NAME = t.TABLE_NAME
FOR XML PATH('')), 1, 2, '') +
@tareq2
tareq2 / htmlExportToPDf.html
Created August 18, 2024 11:29
Generate a pdf file that contains in each page a sequence number 1-n
<html>
<head>
<style>
@media print
{
.no-print, .no-print *
{
display: none !important;
}
}
@tareq2
tareq2 / htmlExportToPDf.html.pdf
Created August 18, 2024 11:29
Generate a pdf file that contains in each page a sequence number 1-n
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tareq2
tareq2 / gist:37ccc533065d2be573c776ae26e34142
Created November 15, 2023 20:33
Powershell to query ldap to find user with an email or any other property
see this site for filter
https://confluence.atlassian.com/kb/how-to-write-ldap-search-filters-792496933.html
$Searcher = New-Object DirectoryServices.DirectorySearcher
$Searcher.SearchRoot = 'LDAP://test.example.local:389/OU=example Root,DC=example,DC=local'
$Searcher.Filter = '(&(email=*))'
$res = $Searcher.FindAll() | Sort-Object path
foreach ($usrTmp in $res)
@tareq2
tareq2 / SalesInfoDataProvider.cs
Created July 30, 2022 11:31
data source for testing in c#
Public class SaleInfo
{
public int OrderId { get; set; }
public int Amount { get; set; }
public DateTime Date { get; set; }
public string Region { get; set; }
public string Country { get; set; }
public string City { get; set; }
}
[
{
"MappingID":"1",
"DocTitle":"Test",
"DocCreateDate":"2021-09-12T12:12:12",
"DocSecLevel":"1",
"BarcodeNumber":"JO0042086867",
"BrachNumber":"ABHA",
"PageCount":"5",
"NickName":"Test",
@tareq2
tareq2 / README.md
Last active June 7, 2021 14:32 — forked from robynitp/README.md
Movie JSON example

Publish some JSON data of your own by forking this gist. Delete my example data and add your own. It can be anything: a list of your favorite songs, statistics on global warming, the number of steps you took in a day. It should be in valid JSON. Use JSON Editor Online to check if your JSON is valid.

For an additional JSON example see this gist with weather data as well as the example files in the JSON folder for week 2.

@tareq2
tareq2 / generate-ios.sh
Created May 26, 2021 11:14 — forked from monmonja/generate-ios.sh
generate ios from command line
# download this file to your project folder and excute
# chmod +x generate-ios.sh
# then run using
# ./generate-ios.sh
# flutter build defaults to --release
flutter build ios
# make folder, add .app then zip it and rename it to .ipa
mkdir -p Payload
@tareq2
tareq2 / Deserializing .cs
Created March 6, 2021 16:49
Deserializing JSON to anonymous types in C#
private string json_moderate = @"{ Name: ""James"", Spouse : { Name: ""Sally""} }";
var example = new { Name = string.Empty, Spouse = new { Name = string.Empty } };
var person = JsonConvert.DeserializeAnonymousType(json_moderate, example);
private string json_complex = @"{ Name: ""James"", Spouse : { Name: ""Sally""}, Children : [ { Name : ""Tom"" }, { Name : ""Sandra"" } ] }";
var example2 = new { Name = string.Empty, Spouse = new { Name = string.Empty }, Children = new[] { new { Name = string.Empty }}};
update [dbo].[Table1]
set image = (select * FROM OPENROWSET(BULK N'd:\uploads\1.jpg', SINGLE_BLOB) AS Document)
,
Thumb = (select * FROM OPENROWSET(BULK N'd:\uploads\2.jpg', SINGLE_BLOB) AS Document)
where id = 11826