Skip to content

Instantly share code, notes, and snippets.

@amaslenn
amaslenn / run-many.sh
Last active April 10, 2020 04:49
Measure parallel runs tims
#!/bin/bash -eE
taskset -c 0-1 ./run-one.sh ucx &
taskset -c 2-3 ./run-one.sh ucx1 &
taskset -c 4-5 ./run-one.sh ucx2 &
taskset -c 6-7 ./run-one.sh ucx3 &
wait
@amaslenn
amaslenn / setup-node_exporter-systemd.sh
Last active March 5, 2020 06:02
Setup a node_exporter systemd service
#!/bin/bash -eEl
function node_exporter_name() {
arch=$(uname -m)
if [ "${arch}" = "aarch64" ]; then
arch="arm64"
elif [ "${arch}" = "x86_64" ]; then
arch="amd64"
fi
@amaslenn
amaslenn / .gitlab-ci.yml
Last active November 22, 2018 12:08
GitLab CI with deploy assets to GitHub Releases
build:
only:
- tags
script:
- 'export upload_url=$(curl -s -H "Authorization: token $github_token" "https://api.github.com/repos/openucx/ucx/releases" | python -c "import sys,os,json; d=json.load(sys.stdin); tag=os.environ.get(\"CI_COMMIT_TAG\"); rel = [r for r in d if r[\"tag_name\"] == tag]; url = rel[0][\"upload_url\"] if rel else \"\"; print url" | grep -oP "https\S+assets")'
- echo $upload_url
- 'export tar_name=$(ls *.tar.gz)'
- echo $tar_name
- 'curl -s -H "Authorization: token $github_token" -H "Content-Type: application/zip" --data-binary @"$tar_name" "${upload_url}?name=${tar_name}&label=${tar_name}"'
@amaslenn
amaslenn / UCX package
Last active October 24, 2017 09:29
Spec file and SRPM for UCX
See attached files.
Work time Rest time Full time Pure work Pure rest
1 20 5 00:25 00:20 00:05
2 20 5 00:50 00:40 00:10
3 20 5 01:15 01:00 00:15
4 20 15 01:50 01:20 00:30
5 20 5 02:15 01:40 00:35
6 20 5 02:40 02:00 00:40
7 20 5 03:05 02:20 00:45
8 20 15 03:40 02:40 01:00

I don't care about history

git remote add secret_prefix-tools ssh://amaslenn@server.com:1234/secret_prefix-tools
git fetch secret_prefix-tools
git branch tools secret_prefix-tools/master
git read-tree --prefix builder/ -u tools:builder
git commit
@amaslenn
amaslenn / build-install-git.sh
Last active May 15, 2017 09:23
Build and install git from sources
git checkout <tag>
make configure
./configure --with-curl
make -j4 all doc
sudo make install install-man
@amaslenn
amaslenn / git-commit-size.pl
Created February 13, 2017 07:30
Get size of commits using perl
# found here: http://stackoverflow.com/questions/1286183/git-find-fat-commit
#!/usr/bin/perl
foreach my $rev (`git rev-list --all --pretty=oneline`) {
my $tot = 0;
($sha = $rev) =~ s/\s.*$//;
foreach my $blob (`git diff-tree -r -c -M -C --no-commit-id $sha`) {
$blob = (split /\s/, $blob)[3];
next if $blob == "0000000000000000000000000000000000000000"; # Deleted
my $size = `echo $blob | git cat-file --batch-check`;
# run external cmd and dump its output in ~realtime
sub run_or_die {
my $cmd = shift;
local $| = 1;
say "[cmd]: $cmd";
open my $hp, "$cmd |" or die "$!\n";
while (<$hp>) {
s/\r|\n//g;
say;
@amaslenn
amaslenn / gg.md
Last active August 29, 2015 14:07
Git and Gerrit

Git and Gerrit

Short story of two tools

First push

Prerequisites:

git clone <repo>
cd <repo>
git checkout work-branch

work work work