Skip to content

Instantly share code, notes, and snippets.

View dnaga392's full-sized avatar
🐱
In front of the computer

mountlong dnaga392

🐱
In front of the computer
View GitHub Profile
@dnaga392
dnaga392 / range-base-for-loop.cpp
Created August 16, 2017 04:42
(C++11) range-base for loop statement example.
#include <iostream>
#include <vector>
int range_base_for_loop()
{
std::vector<int> integers{2, 3, 5, 7, 13};
for (auto&& x : integers)
{
std::cout << "x = " << x << std::endl;
x += 1;
@dnaga392
dnaga392 / array-length.cpp
Created November 15, 2017 02:13
(C++11) example to get array length by template method.
#include <iostream>
template<typename T, std::size_t N>
std::size_t array_length(const T (&a)[N])
{
return N;
}
int main(int argc, char *argv[])
{
@dnaga392
dnaga392 / question.bat
Created July 26, 2018 07:38
(Batch) question batch file with default answer
@echo off
setlocal
:QUESTION
set answer=
set /p answer="Will you execute it? ([y]/n) : %answer%"
if "%answer%"=="" (
echo "default start"
) else if "%answer%"=="y" (
echo "start"
@dnaga392
dnaga392 / xlsx_range_address.py
Last active August 3, 2018 04:48
(python) Get range address script for Excel
import string
def get_range_address(row, col):
"""Convert to range address string
ex)
(4, 1) => 'A4'
(1, 52) => 'AZ1'
Same as follows:
@dnaga392
dnaga392 / md2mpe_img.py
Created September 18, 2020 09:13
Convert a image syntax to mpe import style from markdown style.
"""
Convert a image syntax to mpe import style from markdown style.
![my-image.png](../image/my-image.png)
to
@import "../image/my-image.png" {alt="my-image.png"}
"""
import re