Wednesday, June 08, 2022
under tmux
suddenly I found the mouse is not working, changed tmux.conf
many times still didn't work
turned out the problem is the terminal app, Allow Mouse Reporting
(cmd + r
) is off, means it won`t report mouse events
Sunsetting Atom, we all knew it when microsoft bought gitlab
I was still using sublime even when atom came out, not much memory about it
last couple days I've been working on tuning gitlab ci pipeline speed, some notes
cache or artifacts or kaniko cache or base image
cache
as mentioned in How cache is different from artifacts, generally speaking, share cache between branches, artifacts between stages
our projects are using yarn, so use yarn.lock
as cache key
job:
script:
- echo 'yarn-offline-mirror ".yarn-cache/"' >> .yarnrc
- echo 'yarn-offline-mirror-pruning true' >> .yarnrc
- yarn install --frozen-lockfile --no-progress
cache:
key:
files:
- yarn.lock
paths:
- .yarn-cache/
remember to use --frozen-lockfile
the default cache:policy
pull-push
downloads the cache when job starts and then upload it when job finishes
review the policy
when you have parallel jobs
also use policy: pull
if you don't need to upload the cache
for clean install, use cache: []
to disable cache
cache stores in runner, usually should use runner that tagged with cache label
artifacts
simuliar to cache, artifacts are attached to jobs, by default jobs in later states will download artifacts from previous jobs
so if there're previous jobs defined artifacts
and you don't need it, remember to set dependencies: []
to skip downloads
kaniko cache
I found using kaniko cache is easier for maintaining the ci yaml, we don't need to think about carrying cache/artifacts between stages/jobs
we just need to know, if docker layer is not changed, cache should be applied
for yarn install
caching, instead of
COPY . .
RUN yarn install --frozen-lockfile
do
COPY package.json yarn.lock .
RUN yarn install --frozen-lockfile
COPY . .
so the layer cache "key" will be package.json
and yarn.lock
files, and able to be reuse for other builds
also remember to clear cache to shorten the snapshot time
RUN yarn cache clean
and exclude .git
folder, add to .dockerignore
:
.git*
.git/**/*
and lastly, do not add --cache=true
in your job if you don't need to keep the cache, to avoid the snapshot time
overall it is a bit slower than using cache / artifacts, but I found it much easier to maintain
base image
for common commands/tools (eslint
for example), try build them into a base image
(arguments below are for kaniko/executor
)
you can also use images that built in previous stages (by accepting a --build-arg
):
ARG BASE_IMAGE
FROM $BASE_IMAGE as base
COPY --from=base /path /target
put ARG
above FROM
to make it global, useful for multiple stage builds
use --target
and --skip-unused-stages
to target a special build for local docker-compose
some other minor things:
if everything you need is in the container, you don't need to checkout source files, add this to skip it:
variables:
GIT_STRATEGY: none
skip the whole job if not required, for example, only run the job when files changed in project
folder
only:
changes:
- project/**/*
use only: !reference [previous-job, only]
in later jobs to avoid copy/paste to too many places
use needs
to start a job in next stage even some jobs in current stage is still running
only trigger/skip the job by commit message:
rules:
- if: $CI_COMMIT_MESSAGE =~ /\[build storybook]/
there is Merge request pipelines, only triggers when commit from a merge request
I didn't find it useful because we don't have many self-created branches
only:
- merge_requests
do not run pipeline for new branch (usually a new merge requests created from gitlab ui)
workflow:
rules:
- if: $CI_COMMIT_BEFORE_SHA != "0000000000000000000000000000000000000000"
also only/except will be replaced by rules, but I still prefer using only
/except
Friday, June 10, 2022
good documentation for modern identity solution: Identity Management (Ory Kratos) Concepts
Sunday, June 12, 2022
this is so cool: Useful utilities and toys over DNS
Lightning Memory-Mapped Database, mentioned in this comment
node wrapper: Venemo/node-lmdb: Node.js binding for lmdb
this is another one, support deno: kriszyp/lmdb-js: Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
looks like could replace redis for caching
to know more about lmdb: [Howard Chu - LMDB [The Databaseology Lectures - CMU Fall 2015]](https://www.youtube.com/watch?v=tEa5sAh-kVk)
CMU Database Group has many interesting talks
to me team autonomy probably the key to efficiency: How Big Tech Runs Tech Projects and the Curious Absence of Scrum
reading Modern Systems Programming with Scala Native
Friday, June 17, 2022
learned something new from 4 macOS Screenshot Tricks To Impress Your Co-Workers
so if I don't want to save any files:
cmd + shift + 4
, then hitspace
ctrl + option + click
(copy to clipboard)- open
Preview
(usingcmd + space
),cmd + n
to paste then follow bycmd + shift + a
(annotate) - once done select the area and copy it
- paste to slack
redbean is amazing, it just a zip and you can add lua scripts/html files to it and then run it
and you can find some interesting implementation built on top of it:
- pkulchenko/fullmoon: Fast and minimalistic Redbean-based Lua web framework in one file.
- ardislu/redbean-shorturl: A short URL service using the redbean web server.
Sunday, June 19, 2022
I have a set of simple tools for terminal, but sometimes I also want to access them in spotlight, so maybe wrap them as an app
I tried a little bit of Wails, but seems too much work
then I found Fluid – Turn any webpage into a real Mac App is perfect for my need
there's another simuliar app: Flotato - lost in a sea of browser tabs?
project like pojala/electrino: Desktop runtime for apps built on web technologies, using the system's own web browser engine is also interesting, but fluidapp is good enough for me
Monday, June 20, 2022
working on rules, using these libaraies:
- CacheControl/json-rules-engine: A rules engine expressed in JSON
- vinzdeveloper/json-rule-editor: Json rule editor
the online demo: Rule Editor
further reading:
Wednesday, June 22, 2022
Reproducible Development with Devcontainers, presentation here
so it's a .devcontainer
folder comes with the project, and start a container (with sleep infinity
) for command utils/profiles/vscode setup etc.
it's not a full development environment, but a common shell for developers, very nice
it could solve lots of versioning/environment variables/testing issues, must try
Blog Archive
- Newer Entries
- 2022 July
- 2022 August
- 2022 September
- 2022 October
- 2022 November
- 2022 December
- 2023 January
- 2023 February
- 2023 March
- 2023 April
- 2023 July
- 2023 August
- 2023 September
- 2023 October
- 2023 November
- 2023 December
- 2024 January
- 2024 February
- 2024 March
- 2024 April
- 2024 May
- 2024 June
- 2024 August
- 2024 September
- Older Entries
- 2022 May
- 2022 April
- 2022 March
- 2021 December
- 2021 September
- 2021 August
- 2021 June
- 2021 May
- 2021 April
- 2021 March
- 2021 February
- 2021 January
- 2020 December
- 2020 November
- 2020 October
- 2020 September
- 2020 August
- 2019 December
- 2019 November
- 2019 October
- 2019 July
- 2019 May
- 2019 April
- 2019 March
- 2019 February
- 2019 January
- 2018 December
- 2018 November
- 2018 October
- 2018 September
- 2018 August
- 2018 July
- 2018 June
- 2018 May
- 2018 April
- 2018 March
- 2018 February
- 2018 January
- 2017 December
- 2017 November
- 2017 October
- 2017 September
- 2017 August
- 2017 July
- 2017 June
- 2017 May
- 2017 April
- 2017 March
- 2017 February
- 2017 January
- 2016 December
- 2016 November
- 2016 October
- 2016 September
- 2016 August
- 2016 July
- 2016 June
- 2016 May
- 2016 April
- 2016 March
- 2016 February
- 2016 January
- 2015 December
- 2015 November
- 2015 October
- 2015 September
- 2015 August
- 2015 July
- 2015 June
- 2015 May
- 2015 April
- 2015 March
- 2015 February
- 2015 January
- 2014 December
- 2014 November
- 2014 October
- 2014 September
- 2014 August
- 2014 March
- 2014 February
- 2014 January
- 2013 December
- 2013 October
- 2013 July
- 2013 June
- 2013 May
- 2013 March
- 2013 February
- 2013 January
- 2012 December
- 2012 November
- 2012 October
- 2012 September
- 2012 August