Skip to content

Instantly share code, notes, and snippets.

@alex-berezan
alex-berezan / reclaimWindows10.ps1
Created October 27, 2018 21:15 — forked from alirobe/reclaimWindows10.ps1
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
##########
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Modified by: alirobe <alirobe@alirobe.com> 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 ...
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):
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', '+', '/', '=']
@alex-berezan
alex-berezan / Copy-FolderContentsWithProgress.ps1
Created January 20, 2016 05:20
Sample powershell script for fancy copy of files from one folder to another
function Copy-FolderContentsWithProgress
{
[CmdletBinding()]
Param(
[string] $SourceFolder,
[string] $DestinationFolder
)
$Files = Get-ChildItem -Path $SourceFolder -Recurse
$N = $Files.Length
@alex-berezan
alex-berezan / Unzip-Archive.ps1
Created January 20, 2016 04:39
quick sample for unzipping archive via powershell 2.0
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)
/// <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>
@alex-berezan
alex-berezan / .gitconfig
Created October 30, 2013 18:17
my gitconfig
[user]
name = Aleksey Berezan
email = aleksey.berezan@gmail.com
[core]
editor = notepad
autocrlf = true
excludesfile = ~/.gitignore
ignorecase = true
[alias]
co = checkout
@alex-berezan
alex-berezan / executecommandline.cs
Created October 25, 2013 20:44
Executes specified command line passing given arguments. Logs process output and exit code.
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,
@alex-berezan
alex-berezan / testutil.cs
Created October 25, 2013 19:21
Fills specified instance with default values.
private static void FillInstanceWithDefaults(object instance)
{
if (instance == null)
return;
if (instance.GetType().FullName.StartsWith("System."))
return;
instance.GetType()
.GetProperties()