-
Run the Windows command prompt (cmd.exe) with Administrator privileges.
-
Run this commands to make Grub as the default boot manager:
bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi
-
Restart the computer, then you should see again the Grub menu with both Windows and Ubuntu.
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
using ...; | |
namespace test { | |
class Program { | |
[DllImport("kernel32.dll")] | |
static extern IntPtr GetConsoleWindow(); | |
[DllImport("user32.dll")] | |
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); |
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
using ...; | |
namespace test { | |
class Program { | |
// Call this function to remove the password from memory after use for security | |
[DllImport("KERNEL32.DLL", EntryPoint = "RtlZeroMemory")] | |
public static extern bool ZeroMemory(IntPtr Destination, int Length); | |
private static void Main(string[] args) { |
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
using...; | |
namespace test { | |
class Security { | |
private readonly string KEY = "9hqAcoV7ytrRcoHF!EZDiOy1"; // 24 | |
private readonly string IV = "Zcb7H6&A"; // 8 | |
private readonly string ETO = "___EOT"; | |
public void EncryptFile(string inputFile, string outputFile) { |
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
using ...; | |
namespace test { | |
class Program { | |
private static Random random = new Random(); | |
private static void Main(string[] args) { | |
Console.WriteLine(RandomString(42)); | |
Console.ReadKey(); |
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
/// <summary> | |
/// Create file with random byte | |
/// </summary> | |
/// <param name="fileName"></param> | |
/// <param name="sizeMB">Size in MB</param> | |
private static void CreateRandomByteFile(string fileName, int sizeMB) { | |
byte[] data = new byte[8192]; | |
Random rng = new Random(); | |
// Create file with random bytes |
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
using ...; | |
namespace test { | |
class Program { | |
private static void Main(string[] args) { | |
RunProcess(); | |
} | |
private static void RunProcess() { | |
Process process = new Process(); |
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
using ...; | |
namespace test { | |
class Program { | |
private static void Main(string[] args) { | |
RunProcess(); | |
} | |
private static void RunProcess() { |
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
using ...; | |
namespace test { | |
class Program { | |
[DllImport("User32.dll", CallingConvention = CallingConvention.StdCall, SetLastError = true)] | |
[return: MarshalAs(UnmanagedType.Bool)] | |
private static extern bool ShowWindow([In] IntPtr hWnd, [In] int nCmdShow); | |
private static void Main(string[] args) { | |
ShowWindow(Process.GetCurrentProcess().MainWindowHandle, 6); |
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
# "globals()" returns a dict | |
# with all global variables | |
# in the current scope: | |
>>> globals() | |
{...} | |
# "locals()" does the same | |
# but for all local variables | |
# in the current scope: |