Skip to content

Instantly share code, notes, and snippets.

View sawaYch's full-sized avatar
🐧
Focusing

Sawa sawaYch

🐧
Focusing
View GitHub Profile
@sawaYch
sawaYch / Method1_for_cpp.md
Last active October 26, 2018 22:11
Is there any better way to keep api key private if you push code over here :/ ?

Method 1 (demo using C++) - Encapsulate your api key with class

Create a api key vault class

Like this :

#ifndef API_KEY_VAULT
#define API_KEY_VAULT

#include <string>
using namespace std;
@sawaYch
sawaYch / cpp_boost_makefile.md
Last active October 26, 2018 17:51
C++ Boost & Mysys

Simple makefile for compiling cpp with Boost lib

Install Boost using Mysys2

# pacman -S mingw-w64-x86_64-boost

Just few line

all:./main.cpp
@sawaYch
sawaYch / FS_Allocation.md
Last active December 12, 2018 12:08
Something about operating system.

FS Allocation Methods

Purpose:

  • allocate disk blocks for files, utilize space effectively

3 common way: contiguous, linked, indexed.

@sawaYch
sawaYch / res&ico.md
Last active October 14, 2018 21:42
How to create an exe ico res file (M$Win)

Create .ico

Make .rc file

...with the content like this:
A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "./hc05.ico"

Compile it

windres -i ./res.rc --input-format=rc -o icon.res -O coff

Link the .res file with your program

`

@sawaYch
sawaYch / magic.md
Last active November 7, 2018 15:33
To make WSL work with 32bit emulation

HOW TO MAKE WSL work with 32bit emulation

Based on some tinkering I was doing with qemu for some ARM dev, I think I may have found a technique to allow general 32-bit support in WSL. Hat-tip to @therealkenc for the concept 😁

Edit: requires "Fall Creators Update", 1709, build 16299 or newer (I think)

Presuming a fresh Ubuntu WSL instance, you'll need to install the qemu-user-static package, add the i386 binfmt, enable the i386 architecture, update your package lists, and install some i386 packages:

Install qemu and binfmt sudo apt update sudo apt install qemu-user-static

@sawaYch
sawaYch / msys2.reg
Last active October 13, 2018 02:06
MSYS2, gtkmm-3.0 config
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2]
@="Open MSYS2 here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2\command]
@="c:\\msys64\\usr\\bin\\mintty.exe /bin/sh -lc 'cd \"$(cygpath \"%V\")\"; exec bash'"
[HKEY_CLASSES_ROOT\Folder\shell\open_msys2]
@="Open MSYS2 here"
@sawaYch
sawaYch / Cpp.sublime-build
Last active February 7, 2018 12:15
c++ build system for windows 10 (MinGW) and execute on git-Bash.
{
"cmd": ["g++", "./*.cpp", "-o", "${file_base_name}.exe"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run(native)",
"cmd": ["git-bash", "-c", "./${file_base_name}.exe;echo -e '\\e[0;32m- press any key to continue -';read;"],