Skip to content

Instantly share code, notes, and snippets.

@shahriarhossain
shahriarhossain / Desktime.Hack.ps1
Created August 23, 2020 11:20 — forked from nayan2/Desktime.Hack.ps1
This is a script that will help you to hack your desktime activity by moving mouse
# Clear the host
Clear-Host
# Write/Log the starting date and time
Write-Host "Desktime Hack Started At" (Get-Date -Format G)
# Load assembly to manipulate mouse funationality
Add-Type -AssemblyName System.Windows.Forms
# Load Win 32 dll method for minimize and maximize window
@shahriarhossain
shahriarhossain / TupleCreation_5
Created August 30, 2016 14:10
Specifying element names directly in tuple literals
public (string, string, int) CoolWay_UserInfo(param1, param2, param3.....)
{
string firstName = "Shahriar";
string lastName = "Hossain";
int yearsOfExpertise = 4;
return (fName: firstName, lName: lastName, experience: yearsOfExpertise);
}
@shahriarhossain
shahriarhossain / TupleCreation_4
Last active August 30, 2016 14:09
You can optionally send name that make more sense to you
public (string fName, string lName, int experience) CoolWay_UserInfo()
{
string firstName = "Shahriar";
string lastName = "Hossain";
int yearsOfExpertise = 4;
return (firstName, lastName, yearsOfExpertise);
}
@shahriarhossain
shahriarhossain / TupleCreation_3
Last active August 30, 2016 14:00
Tuple gets simplier with the release of C# 7.0
public (string, string, int) CoolWay_UserInfo()
{
string firstName = "Shahriar";
string lastName = "Hossain";
int yearsOfExpertise = 4;
return (firstName, lastName, yearsOfExpertise);
}
public static Tuple<int, int, int, int, int, int, int, Tuple<Tuple<int, int>>> OldWay_TupleCreation()
{
Tuple<int, int> twoTuple = new Tuple<int, int>(9, 10);
var tempTumple = Tuple.Create(1, 2, 3, 4, 5, 6, 7, twoTuple);
return tempTumple;
}
public static void Main(string[] args)
{
var x = OldWay_UserInfo();
Console.WriteLine("{0} {1} {2}", x.Item1, x.Item2, x.Item3);
}
@shahriarhossain
shahriarhossain / TupleCreation_1
Last active August 30, 2016 12:51
Creating Tuple in C#
public static Tuple<string, string, int> OldWay_UserInfo()
{
string firstName = "Shahriar";
string lastName = "Hossain";
int yearsOfExpertise = 4;
Tuple<string, string, int> userInfo = new Tuple<string, string, int>(firstName, lastName, yearsOfExpertise);
//or
//var userInfo = Tuple.Create(firstName, lastName, yearsOfExpertise);
return userInfo;
}
private const string BaseUrl = "http://intilaqemployees.azurewebsites.net/api/employeesapi";
public async Task<List<Employee>> GetEmployeesAsync()
{
var httpClient = new HttpClient();
try
{
var jsonResponse = await httpClient.GetStringAsync(BaseUrl).ConfigureAwait(false);
//The following line never gets executed
var settings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore,
Converters = new List<JsonConverter>
{
new IsoDateTimeConverter()
{
DateTimeFormat= "yyyy-MM-dd HH:mm:ss"
}
public static void ProcessText([BlobTrigger(@"input-dir/{name}.txt")] TextReader content,
string name,
[Blob(@"output-dir/{name}")] TextWriter contentOutput)
{
Console.WriteLine(String.Format("Reading Content from : {0}", name));
var temp = String.Format("Contents : {0}", content.ReadToEnd());
contentOutput.WriteLine(temp);
}
public static void CopyBlobToBlob([BlobTrigger(@"input-dir/{name}.jpeg")] Stream content,