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
private static bool AdjustDateTime() | |
{ | |
try | |
{ | |
var webReq = WebRequest.Create("http://time.windows.com"); | |
webReq.Method = "HEAD"; | |
var webResp = webReq.GetResponse(); | |
Debug.Print("Begin Response."); | |
foreach (var key in webResp.Headers.AllKeys) | |
{ |
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
<# | |
.SYNOPSIS | |
Get Power Configuration PowerShell Script | |
.EXAMPLES | |
get_powercfg.ps1 | |
#> | |
# https://msdn.microsoft.com/en-us/library/dn622955%28v=vs.85%29.aspx | |
$subgroup = (Get-WmiObject -Namespace root\cimv2\power -Class win32_powersettingSubgroup) | |
$in_subgroup = (Get-WmiObject -Namespace root\cimv2\power -Class win32_powersettingInSubgroup) |
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
atom-text-editor { | |
background:black; | |
color:white; | |
} | |
atom-text-editor .cursor { | |
color:#6e8; | |
} | |
.heading { |
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
int writeTransaction(byte[] data) | |
{ | |
int tryCount = 0; | |
int writtenSize = 0; | |
while (writtenSize < data.Length && tryCount < MAX_TRY) | |
{ | |
var dataForWrite = new byte[data.Length - writtenSize]; | |
Array.Copy(data, writtenSize, dataForWrite, 0, data.Length - writtenSize); | |
var i2ctx = new I2CDevice.I2CTransaction[] { | |
I2CDevice.CreateWriteTransaction(dataForWrite), |
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
dd if=/dev/zero of=zero bs=4k; \rm zero |
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
void DebugOut(wchar_t *fmt, ...) | |
{ | |
va_list argp; | |
va_start(argp, fmt); | |
wchar_t dbg_out[4096]; | |
vswprintf_s(dbg_out, fmt, argp); | |
va_end(argp); | |
OutputDebugString(dbg_out); | |
} |
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
>powershell -mta | |
Windows PowerShell | |
Copyright (C) 2014 Microsoft Corporation. All rights reserved. | |
PS > [system.threading.thread]::CurrentThread | |
ManagedThreadId : 7 | |
ExecutionContext : System.Threading.ExecutionContext | |
Priority : Normal |
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-AuthenticodeSignature c:\windows\explorer.exe).SignerCertificate.Subject | |
# Output sample: | |
# CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US |
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
function Compare-FileVersion { | |
param($path, $version_str) | |
$ver_info = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($path) | |
if ($ver_info.FileVersion -eq $version_str) { | |
return $True | |
} | |
return $False | |
} |
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
function IsEqualBinFile { | |
param($src, $dst) | |
$src_hash = Get-FileHash $src | |
$dst_hash = Get-FileHash $dst | |
if ($src_hash.Hash -eq $dst_hash.Hash) { | |
return $True | |
} | |
return $False | |
} |
NewerOlder