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 bitarray = Enumerable.Range(0, 0x100).Select(i => { var x = Convert.ToString((Byte)i, 2); | |
return new string('0',8-x.Length)+x; | |
}).Count(s => (s.IndexOf("1111") >= 0 || s.IndexOf("000") >= 0)); |
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
//need .net 4.0 | |
var s1 = Enumerable.Range(1, 10).ToList().Select(i => new {name = i%7,sex =i,age= i*10}); | |
var s2 = Enumerable.Range(1, 10).ToList().Select(i => new {name = i & 0xFE}); | |
var result = s2.Join(s1, arg => arg.name, arg => arg.name, (a, b) => b).Distinct(); | |
if(result.Any()) | |
{ | |
result.ToList().ForEach(obj => _show(obj.name + "/"+ obj.sex + "/" + obj.age));//+"/" + obj.b)); |
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
//System.Reflection | |
public class Invoker | |
{ | |
private readonly List<object> _mCommand; | |
private const BindingFlags Flags = BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.Instance; | |
public Invoker() |
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
$url="full name much better eg. http://www.google.com" | |
#$xhttp= New-Object -ComObject msxml2.xmlhttp | |
#$xhttp.open("get",$url,$false) | |
#$xhttp.send() | |
#$xhttp.responseText | |
#$xhttp.status | |
#$xhttp.getAllResponseHeaders() | |
#alse you can net.webclient | |
#$req =[net.httpwebrequest]::Create($url) |
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
#source="http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/19/use-powershell-to-find-last-logon-times-for-virtual-#workstations.aspx?utm_source=twitterfeed&utm_medium=twitter" | |
$Computer = 'NJLT-Service' | |
$Win32OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer | |
$Build = $Win32OS.BuildNumber | |
#The “If ($Build -ge 6001)” is the first decision point. | |
#if the build number is 6001 and above, the script block will run. | |
if ($Build -ge 6001) | |
{ | |
$Win32User = Get-WmiObject -Class Win32_UserProfile -ComputerName $Computer |
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 Get-HexDump($path,$width=10, $bytes=-1) | |
{ | |
$OFS="" | |
Get-Content -Encoding byte $path -ReadCount $width ` | |
-totalcount $bytes | Foreach-Object { | |
$byte = $_ | |
$hex = $byte | Foreach-Object { | |
" " + ("{0:x}" -f $_).PadLeft(2,"0")} | |
$char = $byte | Foreach-Object { | |
if ([char]::IsLetterOrDigit($_)) |
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
from http://msmvps.com/blogs/lduncan/pages/20217.aspx | |
How Do I Rebuilt a Corrupt WMI Repository? | |
The following can be done through a batch file or executed manually from the command line: | |
net stop winmgmt | |
c: | |
cd %systemroot%\system32\wbem | |
rd /S /Q repository | |
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
/*you need file */ | |
/* | |
You can visit http://autoproxy2pac.appspot.com/ | |
download http://autoproxy2pac.appspot.com/gfwtest.js append some stuff | |
e.g |
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
#Summary: Microsoft Scripting Guy, Ed Wilson, | |
#talks about using Windows PowerShell to set the static IP and DNS addresses on a server. | |
#Microsoft Scripting Guy, Ed Wilson, is here. | |
#One of the really cool things about computers is that you never get bored. | |
#At least for me this is true. | |
#for example, I have a server that has been running Exchange Server | |
#absolutely perfectly for more than a year. | |
#Today, it acted like a 150 pound St. Bernard that had become bored. | |
#That’s right, it threw a fit. Why did it do so? Well, I had changed the IP network configuration, | |
#and I did not change the IP address on this machine. for some reason, |
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
I have no idea add some comm for MSDN | |
Worker remoteWorker = (Worker) ad.CreateInstanceAndUnwrap( | |
Assembly.GetExecutingAssembly().FullName, | |
"Worker"); issue==> typeof(Worker).FullNam | |
OlderNewer