This file contains hidden or 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 ab2str(buf) { | |
return String.fromCharCode.apply(null, new Uint16Array(buf)); | |
} | |
function str2ab(str) { | |
var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char | |
var bufView = new Uint16Array(buf); | |
for (var i=0, strLen=str.length; i<strLen; i++) { | |
bufView[i] = str.charCodeAt(i); | |
} |
This file contains hidden or 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
--DROP PROCEDURE BaseLineTableRowsCount_Proc | |
CREATE PROCEDURE BaseLineTableRowsCount_Proc | |
AS | |
BEGIN | |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED | |
IF ( NOT EXISTS (SELECT * | |
FROM INFORMATION_SCHEMA.TABLES | |
WHERE TABLE_SCHEMA = 'dbo' | |
AND TABLE_NAME = 'BaseLineTableRowsCount')) | |
BEGIN |
This file contains hidden or 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
select t.name as TableName, ds.name as FileGroupName, SUM(u.total_pages) * 8 / 1024 as SizeMB | |
from sys.tables as t inner join sys.partitions as p on t.object_id = p.object_id | |
inner join sys.allocation_units as u on p.partition_id = u.container_id | |
inner join sys.data_spaces as ds on u.data_space_id = ds.data_space_id | |
group by t.name, ds.name | |
order by SizeMB desc |
This file contains hidden or 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
C:\Windows\System32\inetsrv\config\applicationHost.config |
This file contains hidden or 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
#!/bin/sh | |
# Helper | |
safeRunCommand() { | |
typeset cmd="$*" | |
typeset ret_code | |
echo cmd=$cmd | |
eval $cmd | |
ret_code=$? |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- @FearTheCowboy's Simple PowerShell Task for MSBuild --> | |
<UsingTask TaskName="PowerShell" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll"> | |
<ParameterGroup><ScriptBlock ParameterType="System.String" Required="true" /></ParameterGroup> | |
<Task><Reference Include="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll"/><Code Type="Class" Language="cs"><![CDATA[ | |
public class PowerShell : Microsoft.Build.Tasks.Exec { | |
public string ScriptBlock {set { EchoOff=true; Command = string.Format( "@powershell \"Invoke-Command -ScriptBlock {{ $errorActionPreference='Stop'; {0} ; exit $LASTEXITCODE }} \"", value.Replace("\"","\"\"").Replace("\r\n",";").Replace("\n",";").Replace("\r",";")); } } | |
}]]></Code></Task> | |
</UsingTask> |
This file contains hidden or 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 Install-VisualStudio | |
{ | |
[CmdletBinding()] | |
param ( | |
[string] $ImagePath, | |
[string[]] $ArgumentList, | |
[string] $InstallPath, | |
[string] $ProductKey | |
) | |
Write-Verbose "Install Visual Studio 2012..." |
This file contains hidden or 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
http.cors.enabled: true | |
http.cors.allow-origin: "*" | |
I add these lines to /etc/elasticsearch/elasticsearch.yml and restart elasticsearch service, then it works for me. |
This file contains hidden or 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
use admin | |
db.createUser( | |
{ | |
user: "mongodbuser", | |
pwd: "mongodbpass", | |
roles: [ { role: "root", db: "admin" } ] | |
} | |
); | |
exit; |
This file contains hidden or 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-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | | |
Get-ItemProperty -name Version,Release -EA 0 | | |
Where { $_.PSChildName -match '^(?!S)\p{L}'} | | |
Select PSChildName, Version, Release, @{ | |
name="Product" | |
expression={ | |
switch -regex ($_.Release) { | |
"378389" { [Version]"4.5" } | |
"378675|378758" { [Version]"4.5.1" } | |
"379893" { [Version]"4.5.2" } |