Obtain global IP in bash

In current Internet environment, every PC is assigned a private IP. If global IP is necessary, the router the PC is connecting has the IP. But accessing the router typically needs the password to access that should not appear on a bash script. If you access http://checkip.dydns.com/, it returns the global IP, then the bash… Continue reading Obtain global IP in bash

Published
Categorized as net Tagged ,

Create log file in the directory of the script in Python

__file__ is the script file itself. From python3.9 above, it is an absolute path, otherwise the path passed by command line. os.path.join joins two paths. realpath returns a absolute path, it also resolves symbolic links. You can also call abspath or normpath. dirname returns the directory. splitext returns list of strings split by extension.

Creating a break point that hits on calling win32 api

Create a break point that hits when CreateProcess was called Enter a Function Breakpoint Enter {,,kernel32.dll}CreateProcessW in the textbox labelled as ‘Function Name’. Showing call stack First, the break point might not hit in the main thread, in that case choose the main thread or other thread that you expect to call CreateProcess. For example,… Continue reading Creating a break point that hits on calling win32 api

Basic usage of unique_ptr and custom free of it

#include <Windows.h>   #include <iostream> #include <memory>   #pragma comment(lib, "Shell32.lib") using namespace std;   class MyClass { public: MyClass() { cout << "ctor" << endl; } ~MyClass() { cout << "dtor" << endl; } };   int main() { { // basic unique_ptr<MyClass> p1(new MyClass); unique_ptr<MyClass> p2 = make_unique<MyClass>(); }   { int* pI… Continue reading Basic usage of unique_ptr and custom free of it

Published
Categorized as C++ Tagged

“new.h” or “ctype.h” is missing in Visual Studio 2017

Visual Studio has some bugs to not find install component properly. If you encounter this error, take a following step. 1, Launch Visual Studio Installer. If it starts to update itself. The problem may be fixed. Just update it (not install any components). 2, Launch your Solution. If Visual Studio failed to load projects properly,… Continue reading “new.h” or “ctype.h” is missing in Visual Studio 2017

Welcome to the Gutenberg Editor

The goal of this new editor is to make adding rich content to WordPress simple and enjoyable. This whole post is composed of pieces of content—somewhat similar to LEGO bricks—that you can move around and interact with. Move your cursor around and you’ll notice the different blocks light up with outlines and arrows. Press the… Continue reading Welcome to the Gutenberg Editor