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 / st4-changelog.md
Last active July 14, 2020 07:26 — forked from jfcherng/st4-changelog.md
Sublime Text 4 changelog just because it's not on the official website yet.
@dungsaga
dungsaga / JavaScript-Bookmarklet-in-IE.md
Created September 9, 2020 03:28
JavaScript Bookmarklet in IE

Each bookmark is stored in a shortcut file under %USERPROFILE%/Favorites It looks like this:

[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,15
[InternetShortcut]
URL=javascript:alert('oh yea')
IDList=
[Bookmarklet]
ExtendedURL=javascript:alert('oh yea')
@dungsaga
dungsaga / committer-date-from-author-date.sh
Last active April 13, 2021 03:44
set committer date to author date for the latest git commit
#!/bin/bash
# set committer date to author date for the latest git commit
env GIT_COMMITTER_DATE=$(git log -1 HEAD | grep Date: | cut -d' ' -f2-) git commit --amend --no-edit --date=$GIT_COMMITTER_DATE
#!/usr/bin/fish
# fish shell use (...) instead of $(...)
env GIT_COMMITTER_DATE=(git log -1 HEAD | grep Date: | cut -d' ' -f2-) git commit --amend --no-edit --date=$GIT_COMMITTER_DATE
#!/bin/bash
@dungsaga
dungsaga / GetNthBusinessDay.sql
Created April 13, 2021 17:55
return Nth business date after or before start date (excluding Saturday and Sunday) using PL/SQL
-- return day of week (Mon=1, Tue=2, ... Sun=7)
FUNCTION WeekDay(weekdayName IN VARCHAR2) RETURN INTEGER AS
weekDay INTEGER;
BEGIN
SELECT DECODE(weekdayName, 'Mon', 1, 'Tue', 2, 'Wed', 3, 'Thu', 4, 'Fri', 5, 'Sat', 6, 'Sun', 7) INTO weekDay FROM Dual;
RETURN weekDay;
end WeekDay;
--End function return day of week
-- return Nth business date after or before start date (excluding Saturday and Sunday)
@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/20120229205513.GA761@cns.vt.edu

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
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