Skip to content

Instantly share code, notes, and snippets.

View Bak-Jin-Hyeong's full-sized avatar

Bak, Jin Hyeong Bak-Jin-Hyeong

View GitHub Profile
#include "CircularBuffer.h"
#include <climits>
#include <cassert>
#include <algorithm>
CircularBuffer::CircularBuffer() = default;
CircularBuffer::~CircularBuffer() = default;
CircularBuffer::CircularBuffer(void* buffer_address, size_t length)
#include <cstring>
#include <algorithm>
#include <utility>
#include <string>
#include <regex>
template<typename C> class EncodeCodePointToUTF {
public:
C encoded[(4 / sizeof(C)) + 1] = {};
int length = 1;
#include <io.h>
#include <fcntl.h>
#include <Windows.h>
auto open_file_for_read_alow_delete(const wchar_t filename[]) {
struct result {
FILE* fp;
long long size;
int error;
};
#define NOMINMAX
#include <fcntl.h>
#include <io.h>
#include <clocale>
#include <cstdio>
#include <vector>
#include <algorithm>
#ifndef GETEXEMODULEPATH__HPP__
#define GETEXEMODULEPATH__HPP__
#if !defined(_WINDOWS_) && !defined(__AFX_H__)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#endif
#include <string>
#ifndef ANONYMOUSPIPE__HPP__
#define ANONYMOUSPIPE__HPP__
#if !defined(_WINDOWS_) && !defined(__AFX_H__)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#endif
#include <cstdlib>
#include <cstdio>
function Get-RegistryValue
{
param
(
[parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] $Path,
[parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] $Value
)
if (Test-Path $Path)
{
param (
[Parameter(Mandatory=$true)][string]$Uri,
[string]$DownloadDir,
[string]$ExtractDir,
[string]$DownloadFilePath
)
$invocation_dir = Split-Path $MyInvocation.MyCommand.Path
$response = Invoke-WebRequest -Uri $Uri -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox
$response_path = $response.BaseResponse.ResponseUri.AbsolutePath.Split('/')
@Bak-Jin-Hyeong
Bak-Jin-Hyeong / perfer_dGPU.cpp
Created June 29, 2017 07:26
enable NVidia Optimus & AMD PowerXpress
extern "C"
{
__declspec(dllexport) int NvOptimusEnablement = 1;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
function Get-AliasPattern($exe) {
$aliases = @($exe) + @(Get-Alias | Where-Object { $_.Definition -eq $exe } | Select-Object -Exp Name)
"($($aliases -join '|'))"
}
$options = @(
@(@('-A', '--after-context'), @('<NUM>')),
@(@('-B', '--before-context'), @('<NUM>')),
@(@('-S', '--case-sensitive'), @()),
@(@('', '--color'), @('never', 'auto', 'always', 'ansi')),