Skip to content

Instantly share code, notes, and snippets.

@Maximus5
Maximus5 / get-admin.bat
Last active March 18, 2024 17:28
Sample batch to run itself elevated
@echo off
echo Checking for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
echo Permission check result: %errorlevel%
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
@Maximus5
Maximus5 / test.cpp
Created August 13, 2020 13:08 — forked from qpfiffer/test.cpp
C++ Memory Leak Detection in VS2010
#ifdef _DEBUG
#include <ostream>
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif
// ...
@Maximus5
Maximus5 / gist:8ebaf9a7c7134d928148
Created May 19, 2014 06:16
Run irssi in ConEmu task contents (supposing it's installation path is "C:\irssi")
"SET PATH=C:\irssi\bin;%PATH%" & SET PERL5LIB=lib/perl5/5.8 & SET TERMINFO_DIRS=terminfo & irssi.exe -cur_console:d:"C:\irssi"
@Maximus5
Maximus5 / pr.md
Created March 11, 2019 13:46 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@echo off
if NOT "%~1" == "" (
goto :%~1
pause
)
:in_gui
call cecho /Green "This is first tab, running new tab with two splits"
echo on
@Maximus5
Maximus5 / latency.markdown
Created August 31, 2018 20:08 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@Maximus5
Maximus5 / BiDiSupport.md
Created July 31, 2018 07:16 — forked from XVilka/BiDiSupport.md
BiDirectional Text

This gist will show the support of BiDirectional text in the terminal emulators and console programs.

How to test

Logical Order ◀ ◀ ◀ RTL LTR ▶ ▶ ▶
WHAT IS UNICODE؟ in arabic in arabic ؟EDOCINU SI TAHW ؟EDOCINU SI TAHW in arabic
ما هو الترميز الموحد يونيكود؟ in Arabic ما هو الترميز الموحد يونيكود؟ in Arabic
@Maximus5
Maximus5 / sleep_1.5ms.cmd
Created December 17, 2013 22:14
Need to "sleep" in your batch file? Use ConEmu's ANSI sequence. Note, real \x1B codes are not visible in gist, download file as RAW.
@echo Sleeping 1.5 sec...]9;1;1500\Done
@Maximus5
Maximus5 / ConEmu-Dracula.xml
Created April 22, 2018 12:34
Dark color theme 'Dracula' for ConEmu
<?xml version="1.0" encoding="utf-8"?>
<!-- Title: Dark color theme 'Dracula' for ConEmu -->
<!-- Source: https://draculatheme.com/ -->
<!-- License: https://zenorocha.mit-license.org/ -->
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla">
<value name="ColorTable00" type="dword" data="00362a28"/>
<value name="ColorTable01" type="dword" data="00bc4354"/>
<value name="ColorTable02" type="dword" data="003dde66"/>
c]9;10\
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch daily
# Your branch is up-to-date with 'origin/daily'.
#
# Changes to be committed:
# modified: src/ConEmu/ConEmuSize.cpp
# modified: src/ConEmuHk/Ansi.cpp
#