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
########## | |
# Tweaked Win10 Initial Setup Script | |
# Primary Author: Disassembler <[email protected]> | |
# Modified by: alirobe <[email protected]> based on my personal preferences. | |
# Version: 2.20.2, 2018-09-14 | |
# Primary Author Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script | |
# Tweaked Source: https://gist.github.com/alirobe/7f3b34ad89a159e6daa1/ | |
# Tweak difference: | |
# | |
# @alirobe's version is a subset focused on safely disabling telemetry, some 'smart' features and 3rd party bloat ... |
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
def attacks_any_queen(q, queens, count): | |
(i, j) = q | |
for k in range(0, count): | |
(qi, qj) = queens[k] | |
if i == qi or j == qj or (abs(i-qi) == abs(j-qj)): | |
return True | |
return False | |
def place_queen(queens, q_index=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
def convert_base64(bytes): | |
def not_null(x): | |
return 0 if x is None else x | |
i = 0 | |
result = [] | |
while i < len(bytes): | |
PADDING_INDEX = 64 | |
base64_table = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', | |
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '='] |
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 Copy-FolderContentsWithProgress | |
{ | |
[CmdletBinding()] | |
Param( | |
[string] $SourceFolder, | |
[string] $DestinationFolder | |
) | |
$Files = Get-ChildItem -Path $SourceFolder -Recurse | |
$N = $Files.Length |
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 Unzip-Archive([string] $ZipFileName, [string] $DestinationDirectory) | |
{ | |
if(-not [System.IO.Directory]::Exists($DestinationDirectory)) | |
{ | |
[System.IO.Directory]::CreateDirectory($DestinationDirectory) | Out-Null | |
} | |
$shell_app = New-Object -com shell.application | |
$zip_file = $shell_app.namespace($ZipFileName) |
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> | |
/// General purpose extensions. | |
/// </summary> | |
public static class Extensions | |
{ | |
/// <summary> | |
/// Guarantees the not null. | |
/// </summary> | |
/// <typeparam name="T">Type of passed instance.</typeparam> | |
/// <param name="instance">The instance.</param> |
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
[user] | |
name = Aleksey Berezan | |
email = [email protected] | |
[core] | |
editor = notepad | |
autocrlf = true | |
excludesfile = ~/.gitignore | |
ignorecase = true | |
[alias] | |
co = checkout |
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 void ExecuteCommandLine(string fileName, string[] arguments) | |
{ | |
Process process = new Process | |
{ | |
StartInfo = new ProcessStartInfo | |
{ | |
FileName = fileName, | |
Arguments = string.Join(" ", arguments.Select(x => string.Format("\"{0}\"", x))), | |
RedirectStandardOutput = true, | |
RedirectStandardError = true, |
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 void FillInstanceWithDefaults(object instance) | |
{ | |
if (instance == null) | |
return; | |
if (instance.GetType().FullName.StartsWith("System.")) | |
return; | |
instance.GetType() | |
.GetProperties() |