Skip to content

Instantly share code, notes, and snippets.

View ipatalas's full-sized avatar

Ireneusz Patalas ipatalas

  • Wrocław, Poland
View GitHub Profile
# minimal base image
from alpine:3.16.2
# run a no-op command
RUN echo "testing"
@ipatalas
ipatalas / Copy JIRA ID.js
Last active January 20, 2021 10:42
JIRA bookmarklets
let urlParams = new URLSearchParams(location.search);
let fromUrl = /\/browse\/(.*)/.exec(location.pathname);
let jiraId;
if (urlParams.has('selectedIssue')) {
jiraId = urlParams.get('selectedIssue');
} else if (fromUrl) {
jiraId = fromUrl[1];
}
@ipatalas
ipatalas / usage_by_count.sql
Last active April 26, 2022 19:08
Home assistant helpers
SELECT COUNT(1) INTO @total FROM states;
WITH t AS (
SELECT ROW_NUMBER() OVER (ORDER BY `count` DESC) AS row_num, entity_id, count(1) `count`, ROUND(100 * COUNT(1) / @total, 2) percent_of_total
FROM `states`
GROUP BY entity_id
ORDER BY 2 DESC
)
SELECT *, SUM(percent_of_total) OVER (ORDER BY `row_num`) AS cumulative
FROM t
@ipatalas
ipatalas / DmpAnalysis.linq
Created May 11, 2020 10:34 — forked from NickCraver/DmpAnalysis.linq
DMP Analysis in LinqPad
<Query Kind="Program">
<NuGetReference Prerelease="true">Microsoft.Diagnostics.Runtime</NuGetReference>
<Namespace>Microsoft.Diagnostics.Runtime</Namespace>
<Namespace>System</Namespace>
<Namespace>System.IO</Namespace>
<Namespace>System.Linq</Namespace>
<Namespace>System.Text</Namespace>
<Namespace>Microsoft.Diagnostics.Runtime.Utilities</Namespace>
</Query>
@ipatalas
ipatalas / commit-message.js
Last active April 29, 2021 07:21
Azure DevOps bookmarklets
var header = $('.grid-header');
var itemName = "";
var itemId = undefined;
var type = undefined;
if ($('.work-item-form-id').length == 1) {
itemId = $('.work-item-form-id').text();
itemName = $('.work-item-form-title input').val();
type = $('.work-item-type-icon-host').find('i').attr('aria-label');
} else {
@ipatalas
ipatalas / readme.txt
Created November 28, 2019 12:01
Chrome
Regex to filter out most meaningless requests in the Network tab:
/(?<!\.(css|js|gif|png|ico|ttf|woff2?))$/
@ipatalas
ipatalas / .git.config
Last active May 19, 2021 10:21
Git helpers
[alias]
# clean all local branches that no longer have an existing remote
clean-local = "!git remote prune origin && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs -r git branch -D"
# show all ignored (--assume-unchanged) files
ignored = "!git ls-files -v | grep '^[[:lower:]]'"
ignore = update-index --assume-unchanged
unignore = update-index --no-assume-unchanged
s = switch
new-feature = "!f() { git checkout -b feature/$1 --no-track origin/develop; }; f"
new-bugfix = "!f() { git checkout -b bugfix/$1 --no-track origin/develop; }; f"