Saturday, August 1, 2020

C#

  1. To exit the environment(or console dialog), the followings will work, according to this
    You can use Environment.Exit(0); and Application.Exit.

Saturday, May 16, 2020

Regular Expression


  1. To search for unicode character sets used in certain languages, one can use \p properties, i.e. perluniprops. Such as the following to search for a part of strings composed Arabic letters and/or spaces.
    grep '[\s\p{Arabic}]*'
    https://perldoc.perl.org/perluniprops.html#Properties-accessible-through-%5cp%7b%7d-and-%5cP%7b%7d

Friday, May 8, 2020

linux commands

  1. To find which partition is mounted where, use findmnt:
    findmnt /dev/sda1
  2. To mount, use mount, to unmount use umount.
  3. To list all mount disk, "mount -l".
  4. To check file systems
    https://www.tecmint.com/find-linux-filesystem-type/
  5. To make partitions and format and mount, see
    http://www.nemotos.net/?p=3132

Monday, May 4, 2020

Wiktionary


  • Parsing raw compressed dump file. Example to extract the title of all pages().
    bzcat pages-articles.xml.bz2 | grep '<title>[^[:space:][:punct:]]*</title>' | sed 's:.*<title>\(.*\)</title>.*:\1:'
    https://stackoverflow.com/questions/3364279/has-anyone-parsed-wiktionary/9735019
  • Regular expression which include unicode characters. For instance if Arabic,
    ^[\p{Arabic}\s\p{N}]+$
    https://stackoverflow.com/questions/29729391/regular-expression-arabic-characters-and-numbers-only

Saturday, May 2, 2020

BeautifulSoup


  1. To check if an object is of NavigableString instance, one can use
    isinstance(your_obj, bs4.element.NavigableString)
  2. file method executed as a member function of a tag object fails. https://en.wikipedia.org/wiki/Duck_typing
  3. To download image from its url:
    import shutil; import requests
    url = 'http://example.com/img.png'
    response = requests.get(url, stream=True)
    with open('img.png', 'wb') as out_file:
        shutil.copyfileobj(response.raw, out_file)
    del response

    https://stackoverflow.com/questions/13137817/how-to-download-image-using-requests

Writing a post in Markdown in Blogger

Following articles are helpful. * [【令和最新版】Blogger で Markdown を用いて記事を書く方法](https://qiita.com/hoge_fu-ga/items/267ea5ad4f8c120eaeb8) * [Bl...