Skip to content

Instantly share code, notes, and snippets.

Andrey Belyaev Svetomech

Block or report user

Report or block Svetomech

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Svetomech
Svetomech / there_is_no_spoon.cs
Created Sep 12, 2017
"There is no Spoon - Episode 1" CodinGame solution
View there_is_no_spoon.cs
using System;
class Player
{
static void Main(string[] args)
{
int width = int.Parse(Console.ReadLine());
int height = int.Parse(Console.ReadLine());
var grid = new char[width, height];
@Svetomech
Svetomech / vscode-menu_entries.ps1
Created Aug 28, 2017
Adds Visual Studio Code menu entries for ALL users (which the installer won't do, even though it requires admin rights)
View vscode-menu_entries.ps1
## Configure Open with VSCode Context Menu ##
# Configure VSCode location
$vscodeLoc = [Environment]::ExpandEnvironmentVariables("%PROGRAMFILES%") + '\Microsoft VS Code\Code.exe'
$regHive = 'HKLM:' # Change this to 'HKCU:' if you only want this for your current user
# Configure Open with VSCode for files
New-Item -Path "$regHive\SOFTWARE\Classes\*\shell\VSCode"
Set-ItemProperty -LiteralPath "$regHive\SOFTWARE\Classes\*\shell\VSCode" -Name '(Default)' -Type ExpandString -Value 'Open with VSCode'
Set-ItemProperty -LiteralPath "$regHive\SOFTWARE\Classes\*\shell\VSCode" -Name 'Icon' -Type ExpandString -Value "$vscodeLoc"
View Window.Populate.cs
public static class Populate
{
public static Window[] FromHandles(string[] handles)
{
var windows = new Window[handles.Length];
for (int i = 0; i < windows.Length; ++i)
{
windows[i] = new Window(new IntPtr(Convert.ToInt32(handles[i])));
}
View getPasswordHash.cs
using System.Security.Cryptography;
public byte[] GetPasswordHash(string username, string password, string salt)
{
// get salted byte[] buffer, containing username, password and some (constant) salt
byte[] buffer;
using (MemoryStream stream = new MemoryStream())
using (StreamWriter writer = new StreamWriter(stream))
{
writer.Write(salt);
View RandomNumber.cs
using System;
using System.Security.Cryptography;
namespace FDL.Library.Numeric
{
public static class RandomNumber
{
        private static readonly RNGCryptoServiceProvider _generator = new RNGCryptoServiceProvider();
        public static int Between(int minimumValue, int maximumValue)
You can’t perform that action at this time.