Skip to content

Instantly share code, notes, and snippets.

View niepiekm's full-sized avatar

Marek Niepiekło niepiekm

View GitHub Profile
@niepiekm
niepiekm / systemd_services.md
Created May 28, 2018 13:05 — forked from leommoore/systemd_services.md
Systemd Services 101

Check that your system supports systemd

pidof systemd
2733

If this return a number then your system supports systemd. Most Linux distributions in 2017 support systemd.

Check out the proceses currently running.

Since systemd starts the process then all processes will be children of systemd

@niepiekm
niepiekm / Matrix.md
Created May 23, 2018 08:52 — forked from nadavrot/Matrix.md
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@niepiekm
niepiekm / anti_tests.md
Created May 11, 2018 12:02 — forked from androidfred/anti_tests.md
Anti-tests

Anti-tests

The requirement

Let's say we've been tasked with returning 400 when GET /users/<userId> is called with a negative userId.

The test

The requirement can be turned into a test that hits the endpoint with a negative userId and checks that a 400 is returned:

    @Test
    public void getUser_InvalidUserId_400() {
@niepiekm
niepiekm / gist:8c36ec13d64d608bdc1cae730221debc
Created April 27, 2018 11:52 — forked from trongthanh/gist:2779392
How to move a folder from one repo to another
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.
@niepiekm
niepiekm / import.sh
Created April 27, 2018 11:51 — forked from whistler/import.sh
Copy files to another repository while saving git history
# copied from http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
git clone <git repository A url> # clone source repository
cd <git repository A directory>
git remote rm origin # to make sure it doesn't affect the original repository
git filter-branch --subdirectory-filter <directory 1> -- --all # remove all files other than the ones needed
mkdir <directory 1> # move them into another directory where they will be stored in the destination repository (if needed)
mv * <directory 1>
git add .
git commit
@niepiekm
niepiekm / gist:c9f92fcb56cc3b7ca0aab1f64f9290d3
Created April 20, 2018 12:31 — forked from n00neimp0rtant/gist:9515611
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname

One size doesn't fit all :) Submitted by Andrew Sowerby on Mon, 2016-02-15 13:44

Even if this isn't just a way of harvesting user details, which some reviewers seem to think it is, I can't see the point of this plugin.

You can achieve the same results by adjusting your -vmargs in the eclipse.ini, or in your shortcut or command line you use to start the application.

  1. Just add adequate heap settings:

e.g. Xms1024m and Xmx1024m, or more, depending on how hard you push eclipse

[alias]

hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
st = status
co = checkout
br = branch
cm = commit
cma = commit -C HEAD --amend
rs = reset --soft
rh = reset HEAD

@niepiekm
niepiekm / bash_examples.md
Last active January 19, 2018 09:57
Linux bash examples

Print sorted and counted occurances of words in a file

$ cat commands | awk -F” ” ‘{print $4}’ | sort | uniq -c | sort -n

Print sorted and counted occurance of a 'word' in a file

cat some_commands | grep HINCRBY | awk ‘{print $5}’ | sort | uniq -c | sort -n