Skip to content

Instantly share code, notes, and snippets.

View dungsaga's full-sized avatar
👻
ghost in the machine

DungSaga dungsaga

👻
ghost in the machine
View GitHub Profile
@dungsaga
dungsaga / research_keywords.md
Last active May 22, 2021 09:59
research keywords

To research a topic xyz, I often search it with some keywords to know how people feel about it.

love it

  • xyz great
  • xyz love
  • xyz like
  • xyz favorite
  • xyz fun
@dungsaga
dungsaga / hex-words.md
Last active June 15, 2021 09:21
Hex words with only letters (a to f) in English

Hex words with only letters (a to f) in English from https://www.dictionary.com/:

  • a
  • aa (basaltic lava having a rough surface)
  • be
  • ea (the Akkadian god of wisdom, the son of Apsu and father of Marduk: the counterpart of Enki)
  • fa (the syllable used for the fourth tone of a diatonic scale)
  • aba (a coarse, felted fabric woven of camel's or goat's hair)
  • abb (low-grade wool from the breech or outer edges of a fleece)
  • ace
  • ate
@dungsaga
dungsaga / fix_corrupted_git_repo.md
Last active August 5, 2021 10:47
fix corrupted git repo

check for errors

git fsck --full

error: HEAD: invalid reflog entry 9fa7d8a22a680f8cf76e560ddb9e910419936006
error: refs/heads/local-api: invalid reflog entry c26cc0ae14632bd6a6d09aeb8973f97ccfc3035c
error: object file .git/objects/6b/f03a2e38b9cf909eff2500c14fce48a61d2965 is empty
error: object file .git/objects/6b/f03a2e38b9cf909eff2500c14fce48a61d2965 is empty
fatal: loose object 6bf03a2e38b9cf909eff2500c14fce48a61d2965 (stored in .git/objects/6b/f03a2e38b9cf909eff2500c14fce48a61d2965) is corrupt
@dungsaga
dungsaga / re-create_schema_information_schema.md
Last active February 18, 2022 08:19
re-create schema information_schema of a PostgreSql database

reference: https://www.postgresql.org/message-id/[email protected]

Since the view definition is installed by initdb, merely upgrading will
not fix the problem. If you need to fix this in an existing installation,
you can (as a superuser) drop the information_schema schema then re-create
it by sourcing SHAREDIR/information_schema.sql. (Run pg_config --sharedir
if you're uncertain where SHAREDIR is.) This must be repeated in each
database to be fixed.
@dungsaga
dungsaga / install_oracle_xe_18c_under_wsl2.md
Last active June 19, 2024 01:04
install Oracle XE 18x under WSL2

install Oracle XE 18x under WSL2

  • install package is RPM, it's easier to use CentOS 7 or 8 (from CentOS-WSL or wsldl)
  • if you want to use Debian/Ubuntu, you must convert RPM to DEB (but conversion with alien fails under Debian)
  • first, install oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
  • second, install oracle-database-xe-18c-1.0-1.x86_64.rpm
  • see https://mikesmithers.wordpress.com/2019/01/03/installing-and-configuring-oracle-18cxe-on-centos/
  • run as root: /etc/init.d/oracle-xe-18c configure
  • it would fail if host IP is auto-generated to be 127.0.1.1
  • you can update the IP in /etc /hosts and try it again
@dungsaga
dungsaga / install_oracle_xe_18c_under_wsl2.md
Created March 4, 2022 08:34
install Oracle XE 18c under WSL2

install Oracle XE 18c under WSL2

  • install package is RPM, it's easier to use CentOS 7 or 8 (from CentOS-WSL or wsldl)
  • if you want to use Debian/Ubuntu, you must convert RPM to DEB (but conversion with alien fails under Debian)
  • first, install oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
  • second, install oracle-database-xe-18c-1.0-1.x86_64.rpm
  • see https://mikesmithers.wordpress.com/2019/01/03/installing-and-configuring-oracle-18cxe-on-centos/
  • run as root: /etc/init.d/oracle-xe-18c configure
  • it would fail if host IP is auto-generated to be 127.0.1.1
  • you can update the IP in /etc/hosts and try it again
@dungsaga
dungsaga / insert_multiple_rows.md
Created March 4, 2022 09:32
insert multiple rows into Oracle database
@dungsaga
dungsaga / vertical-horizon-code-style.md
Created March 9, 2022 07:24
vertical horizon code style

It's quite common to write SQL queries in a vertical horizon code style. For example:

INSERT INTO table (
    column1,
    column2,
    column3,
    column4,
 column5,
@dungsaga
dungsaga / reduce-size-of-a-WSL-virtual-disk.md
Last active April 17, 2025 04:35
reduce size of a WSL virtual disk

Reduce size with diskpart

You should run PowerShell as Administrator (otherwise diskpart won't be able to received the piped commands)

$vhdx_path = '%USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx'

@"
select vdisk file=$vhdx_path
compact vdisk