Skip to content

Instantly share code, notes, and snippets.

@goofansu
goofansu / circleci-config.yml
Created Apr 15, 2020
Matrix builds in CircleCI
View circleci-config.yml
version: 2.0
shared: &shared
working_directory: ~/repo
steps:
- checkout
- run: mix local.hex --force
- run: mix local.rebar --force
- run: mix deps.get --only test
- run: mix test
View config.el
;;; The modification does two things:
;;; 1. Remove anchor from headline.
;;; 2. Keep markdown image link instead of converting to Hugo's figure shortcode.
;;; It is limited as you need to put the org file with the exported markdowns.
(use-package! ox-hugo
:init
(defun org-gatsby-headline (headline contents info)
"Transcode HEADLINE element into Markdown format.
CONTENTS is the headline contents. INFO is a plist used as
@goofansu
goofansu / textmate-elixir-run.sh.rb
Created Apr 7, 2020
Support packages for Elixir bundle. Set TM_ELIXIR_PACKAGES_PATH and paste following in "Elixir -> Menu Actions -> Run".
View textmate-elixir-run.sh.rb
#!/usr/bin/env ruby18
require "#{ENV['TM_SUPPORT_PATH']}/lib/tm/save_current_document"
require "#{ENV["TM_SUPPORT_PATH"]}/lib/tm/executor"
TextMate.save_if_untitled('exs')
if ENV['TM_FILEPATH'].match(/\/test\/.*_test.exs$/)
TextMate::Executor.run(e_sh(ENV['TM_MIX'] || 'mix'), 'test', ENV['TM_FILEPATH'])
elsif ENV['TM_ELIXIR_PACKAGES_PATH']
TextMate::Executor.run(e_sh(ENV['TM_ELIXIR'] || 'elixir'), '-pa', ENV['TM_ELIXIR_PACKAGES_PATH'], ENV['TM_FILEPATH'])
@goofansu
goofansu / uninstall-aegis.sh
Last active Mar 30, 2020
Uninstall aegis on Aliyun
View uninstall-aegis.sh
curl -sSL http://update.aegis.aliyun.com/download/quartz_uninstall.sh | sudo bash
sudo rm -rf /usr/local/aegis
sudo rm /usr/sbin/aliyun-service
@goofansu
goofansu / hex-repo-upyun.sh
Last active Mar 30, 2020
[Elixir] Set hex repo url to upyun mirror
View hex-repo-upyun.sh
mix hex.repo set hexpm --url https://hexpm.upyun.com
@goofansu
goofansu / reset-local-branch.sh
Last active Mar 30, 2020
Reset local repository branch to be just like remote repository HEAD
View reset-local-branch.sh
# https://stackoverflow.com/questions/1628088/reset-local-repository-branch-to-be-just-like-remote-repository-head
git fetch origin
git reset --hard origin/master
@goofansu
goofansu / notion-multi-select-count.js
Last active Mar 30, 2020
Calculate the count of the multi-select property
View notion-multi-select-count.js
/*
Fields required:
1. Notes: Multiple Choices
*/
if(empty(prop("Notes")), 0, length(replaceAll(prop("Notes"), "[^,]", "")) + 1)
@goofansu
goofansu / notion-recurring-date.js
Last active Mar 30, 2020
Notion Formula: Recurring Date by month
View notion-recurring-date.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")))
@goofansu
goofansu / notion-days-left.js
Last active Mar 30, 2020
Notion Formula: Days Left
View notion-days-left.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 / logrotate-rails-app
Last active Mar 30, 2020
Logrotate config for rails application
View logrotate-rails-app
/app/helloworld/log/production.log {
daily
rotate 7
copytruncate
dateext
compress
delaycompress
missingok
notifempty
}
You can’t perform that action at this time.