Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Yejun Su goofansu

🏠
Working from home
Block or report user

Report or block goofansu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@goofansu
goofansu / notion.js
Last active Feb 15, 2020
Notion Formula: Calculate the count of multiple choices https://gist.github.com/41f29243e10bc6692eb7613178cfe8c7
View notion.js
/*
Fields required:
1. Notes: Multiple Choices
*/
if(empty(prop("Notes")), 0, length(replaceAll(prop("Notes"), "[^,]", "")) + 1)
@goofansu
goofansu / notion.js
Created Feb 10, 2020
Notion Formula: Recurring Date by month
View notion.js
/*
Fields required:
1. Last Paid: Date
*/
if(date(prop("Last Paid")) < date(now()), join(" ", formatDate(dateAdd(now(), 1, "months"), "MMM"), formatDate(prop("Last Paid"), "DD")), join(" ", formatDate(now(), "MMM"), formatDate(prop("Last Paid"), "DD")))
View notion.js
/*
Fields required:
1. Archived: Boolean
2. Deadline: Date
*/
if(prop("Archived") == true, "✅Done", if(empty(prop("Deadline")), "⚠️No Deadline", if(formatDate(prop("Deadline"), "YYYY/MM/DD") == formatDate(now(), "YYYY/MM/DD"), "🎯Do it!", if(formatDate(prop("Deadline"), "YYYY/MM/DD") > formatDate(now(), "YYYY/MM/DD"), format(dateBetween(prop("Deadline"), now(), "days")), "🚨Overdue"))))
@goofansu
goofansu / config
Created Jan 14, 2020
Setup logrotate for rails application
View config
/app/helloworld/log/production.log {
daily
rotate 7
copytruncate
dateext
compress
delaycompress
missingok
notifempty
}
@goofansu
goofansu / script.sh
Last active Jan 13, 2020
Download pbskids dinosaurtrain cards
View script.sh
brew install jq parallel grep gnu-sed
cat field-guide.json \
| jq '.[] | .name' \
| gsed -e 's/"\(.*\)"/https:\/\/pbskids.org\/dinosaurtrain\/fieldguide\/dinosaurs\/\L\1\/card\.png/g' \
| parallel -I {} curl -o "(echo {} | ggrep -oP '(?<=dinosaurs/).*(?=/)').png" {}
@goofansu
goofansu / script.sh
Created Jan 13, 2020
Delete all files excluding specified file pattern
View script.sh
find . -type f ! -name '*.txt' -delete
@goofansu
goofansu / script.sh
Created Jan 13, 2020
Find file by name and edit text in-place
View script.sh
find . -type f -name 'filename' | xargs -I {} sed -i -e 's/str1/str2/' {}
@goofansu
goofansu / script.sh
Created Jan 13, 2020
Check file size in current directory
View keybase.md

Keybase proof

I hereby claim:

  • I am goofansu on github.
  • I am goofansu (https://keybase.io/goofansu) on keybase.
  • I have a public key ASBU12U7vWM6YMWGJqxMrCWrtGFGeYQqNftGl15Qig2TtAo

To claim this, I am signing this object:

You can’t perform that action at this time.