Skip to content

Instantly share code, notes, and snippets.

@BurstX
BurstX / SearchQuery.cs
Last active May 10, 2016 08:18
Query search app
using (var ctx = new ClientContext(this.SiteCollectionUri)) // TEST root site collection URL
{
ctx.ExecutingWebRequest += (object sender, WebRequestEventArgs e) =>
{
// e.WebRequestExecutor.WebRequest.UserAgent = @"Mozilla/4.0 (compatible; MSIE 4.01; windows NT; MS Search 6.0 Robot)";
e.WebRequestExecutor.WebRequest.Headers.Add(@"X-FORMS_BASED_AUTH_ACCEPTED", @"f");
};
var query = new KeywordQuery(ctx);
query.QueryText = "WebTemplate:STS";
@BurstX
BurstX / OpenSite.ps1
Created January 19, 2017 12:54
PowerShell: open site which was closed and set as read-only via a site policy
$spWeb = Get-SPWeb $SiteUrl
# Check whether site is closed
$isClosed = [Microsoft.Office.RecordsManagement.InformationPolicy.ProjectPolicy]::IsProjectClosed($spWeb)
if($isClosed)
{
[Microsoft.Office.RecordsManagement.InformationPolicy.ProjectPolicy]::OpenProject($spWeb)
}
@BurstX
BurstX / Get-SitePolicy.ps1
Created March 21, 2017 10:24
PowerShell script to check if a site policy exists in a specified list of SharePoint sites
<#
.SYNOPSIS
Tht script checks is a site policy exists in a site collection.
.DESCRIPTION
.PARAMETER SiteUrl
URL of a site collection to check the policy existence.
.PARAMETER PolicyName
Name of the policy to check.
#>
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="ShowWithSampleData" type="bool">False</property>
<property name="Default" type="string" />
Материалы для дополнительного чтения на английском:
https://golang.org/ref/spec - спецификация по язык
https://golang.org/ref/mem - модель памяти го. на начальном этапе не надо, но знать полезно
https://golang.org/doc/code.html - про организацию кода. GOPATH и пакеты
https://golang.org/cmd/go/
https://blog.golang.org/strings
https://blog.golang.org/slices
https://blog.golang.org/go-slices-usage-and-internals
https://github.com/golang/go/wiki - вики го на гитхабе. очень много полезной информации
<#
.SYNOPSIS
! UPDATE THE VARIABLES IN THE BEGINNING
OF THE SCRIPT ACCORDING TO YOUR ENVIRONMENT
x
The script sets up the environment to reproduce the problem
stated in https://social.msdn.microsoft.com/Forums/en-US/7c93cb0c-d500-477b-b9fa-83f604299a28/expansion-of-wildcard-will-possibly-exceed-10000-terms?forum=sharepointsearch
The script creates:
1) a file share on the local drive with a tree of folders
@BurstX
BurstX / Get-OfflineOneDriveFiles.ps1
Created May 4, 2021 09:33
PowerShell (posh) script to get all the offline (taking hard-drive space) files in OneDrive local folder
<#
.SYNOPSIS
Borrowed code: https://github.com/PowerShellJax/Get-FileMetaData/blob/master/Get-FileMetaDataFunction.ps1
#>
param(
[Parameter(Mandatory=$true)]
[string] $OneDriveRootDiskPath
)
Get-EventLog -LogName System |? {$_.EventID -in (6005,6006,6008,6009,1074,1076)} | ft TimeGenerated,EventId,Message -AutoSize –wrap
@BurstX
BurstX / Uninstall-Cortana.ps1
Created July 15, 2021 09:27
Uninstall Cortana from Windows 10 via PowerShell
Get-AppxPackage -allusers Microsoft.549981C3F5F10 | Remove-AppxPackage
using System;
using System.Collections;
using System.Security.Cryptography;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace MyBenchmarks
{
public class CompareArraysBenchmark
{