Skip to content

Instantly share code, notes, and snippets.

Avatar
👻
ghost in the machine

DungSaga dungsaga

👻
ghost in the machine
View GitHub Profile
@dungsaga
dungsaga / fix_corrupted_git_repo.md
Last active Aug 5, 2021
fix corrupted git repo
View fix_corrupted_git_repo.md

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 / hex-words.md
Last active Jun 15, 2021
Hex words with only letters (a to f) in English
View hex-words.md

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 / research_keywords.md
Last active May 22, 2021
research keywords
View research_keywords.md

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 / GetNthBusinessDay.sql
Created Apr 13, 2021
return Nth business date after or before start date (excluding Saturday and Sunday) using PL/SQL
View GetNthBusinessDay.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 / spleeter.md
Last active Nov 7, 2021
Voice removal AKA karaoke creator
View spleeter.md
@dungsaga
dungsaga / funny_acronym_php.md
Last active Jul 8, 2021
funny acronym: what does PHP stand for?
View funny_acronym_php.md

Prrr Home Page

  • Pretty Home Page (this is said to be the initial meaning of PHP)
  • Professional Homepage Power
  • Private Home Page
  • Personal Home Page
  • Phucking Home Page

Programmable

View JavaScript-Bookmarklet-in-IE.md

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 / st4-changelog.md
Last active Jul 14, 2020 — forked from jfcherng/st4-changelog.md
Sublime Text 4 changelog just because it's not on the official website yet.
View st4-changelog.md
@dungsaga
dungsaga / integer-list-generator.js
Last active Jul 10, 2020
integer list generator in JS
View integer-list-generator.js
// while reading "Why List Comprehension is Bad" (http://xahlee.info/comp/list_comprehension.html),
// I notice that JS don't have integer list generator like 0..9 or range(0,9)
// I wanna see if a one-liner can do that
// using generator
function*(){let i=0;while(i<9)yield i++}()
function*(i=0){while(i<9)yield i++}()
Array(9).keys()
// using array (so it's easier to chain map, filter, ...)
@dungsaga
dungsaga / committer-date-from-author-date.sh
Last active Apr 13, 2021
set committer date to author date for the latest git commit
View committer-date-from-author-date.sh
#!/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