Skip to content

Instantly share code, notes, and snippets.

Dmytro Konstantinov UrsaDK

Block or report user

Report or block UrsaDK

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
@UrsaDK
UrsaDK / Caching multi-stage builds in GA.md
Last active May 13, 2020
Speed up your multistage builds in GitHub Actions
View Caching multi-stage builds in GA.md

Caching multi-stage builds in GitHub Actions

Caching Docker builds in GitHub Actions is an excellent article by @dtinth which analyses various strategies for speeding up builds in GitHub Actions. The upshot of the article is a fairly decisive conclusion that the best two ways to improve build times are:

  1. Build images via a standard docker build command, while using GitHub Packages' Docker registry as a cache = Longer initial build but fastest re-build times.

  2. Build your images via docker integrated BuildKit (DOCKER_BUILDKIT=1 docker build), while using a local registry and actions/cache to persist build caches = Fastest initial build but slightly longer re-build times.

The problem

@UrsaDK
UrsaDK / github-environment-cleaner.sh
Last active May 14, 2020
How to remove the "environment" tab from a Github repo
View github-environment-cleaner.sh
#!/usr/bin/env bash
#
# Remove Project Environment artefacts from a Github project: This script
# can be used to remove all "environment" artefacts from a project that,
# for example, no longer uses github-pages. Doing so would also remove the
# "environment" tab from the Github repository.
#
# The script requires for `curl` and `jq` to be in your PATH. You will also
# need to define a personal access token with `repo_deployment` scope on
# Github, and update the values of API_URL_BASE and ACCESS_TOKEN bellow.
@UrsaDK
UrsaDK / Letter to Apple.md
Last active Apr 16, 2020
How to set @icloud.com mail alias as your Apple ID?
View Letter to Apple.md

Dear @Apple,

Please allow us to rename existing @icloud.com Apple IDs to a mail aliases defined on the same account (that's the additional email address defined via the Preferences pane of the Mail app on icloud.com).

An Apple account is identified by its Apple ID, which for a long standing account, has a lot of information associated with it. However, an account handle set up years ago can become irrelevant over time (people get married, change their names, etc).

We already can define Mail aliases for existing Apple IDs. These aliases are used with Mail, Messages and Facetime... but not when we share content via the share button/menu (ie: if you share a note or a reminder with someone the content will be shared using your Apple ID).

Currently, the only way to fix this is to create a brand new Apple ID, and then migrate all of your existing content to that Apple ID. However, this is not an acceptable solution to many people.

@UrsaDK
UrsaDK / How to fix macOS VirtualBox install failure.md
Last active Apr 16, 2020
How to recover from VirtualBox installer failure on macOS host
View How to fix macOS VirtualBox install failure.md

I find that every now and again VirtualBox glitches out and fails to install (or update) on macOS. This has happened to me a few times now, and every single time it's because Apple security policies prevent VirtualBox kernel extensions from being loaded.

Screenshot of the failed install

Attempt 1 of 2: Start with OSXDaily fix: check your "System Preferences > Security & Privacy > General". There might be a discreet note in the lower part of the window saying that kernel extensions from the developer Oracle could not be loaded and an option to whitelist them by clicking on the "Allow" button. Done! :)

@UrsaDK
UrsaDK / docker-clean.sh
Last active Nov 4, 2016
Reclame space used up by Docker on macOS
View docker-clean.sh
#!/usr/bin/env bash
echo "Removing unused containers ..."
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v
echo
echo "Removing unused images ..."
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs docker rmi
echo
@UrsaDK
UrsaDK / unaccent.sql
Last active Apr 16, 2020
Replace musicbrainz_unaccent with pgsql's unaccent extension
View unaccent.sql
/**
* MusicBrainz (http://musicbrainz.org) comes with a custom unaccent pgsql extension (musicbrainz_unaccent).
* However, AWS PGSQL service does not include this extension and it can not be easilly added.
*
* The following code duplicates musicbrainz_unaccent functionality using the built in unaccent extension.
*/
CREATE EXTENSION unaccent;
CREATE OR REPLACE FUNCTION musicbrainz_unaccent(txt text) RETURNS text AS $$
BEGIN
@UrsaDK
UrsaDK / Strip trailing space in Vim.md
Last active Apr 16, 2020
A function to remove trailing spaces from Vim buffers
View Strip trailing space in Vim.md

I've been maintaining my own version of Strip Trailing Spaces function (attached at the bottom of this post) since I first started using vim. It grew out of a simple :%s/\s*$// and now includes a number of features:

  • it preserves search history and the last search string
  • it doesn't change editor's '', '. and '^ marks
  • it doesn't add a new jumplist and changelist record
  • it preserves editor's view and cursor position

However, over the years I've noticed that I never needed to undo the results of stripping trailing spaces from a file. In fact, I would go as far as to say that when undoing changes in a file, the function produces an understandable but somewhat undesirable cursor jump (to the top-most trailing space it strippes) which disrupts my work flow. So, I set about to exclude the results of this function from the undo history all together.

After reading [Restore the cursor position after undoing text change made by a script](http://vim.wikia.com/wiki/Restore_the_cursor_position_aft

@UrsaDK
UrsaDK / TreeFind.vim
Last active Feb 3, 2019
Project structure discovery with Vim & NERDTree
View TreeFind.vim
""
" Return project's root directory
"
" This function is used to return current projects root directory, as
" determined by GIT or SVN, without changing vim's cwd.
"
" @param string a:1 A comma seperated list of files or directories, the
" presence of which can be used to identify the root directory of a project.
"
function! UmkaDK#GetProjectRoot(...)
You can’t perform that action at this time.