Skip to content

Instantly share code, notes, and snippets.

View soanvig's full-sized avatar

Mateusz Koteja soanvig

View GitHub Profile
@soanvig
soanvig / git-rename-commits.sh
Last active December 16, 2021 18:56
Git: rename words in all commits without resolving conflicts again
git filter-branch -f --msg-filter 'cat "$@" | sed \'s/FOO/BAR/g\'' -- master
@soanvig
soanvig / vue-reactivity.js
Last active December 16, 2021 18:58
Vue reactivity underhood - simple example
// Dep is dependency tracker
// Each tracked value (property of some state object)
// should have it's own Dep object.
class Dep {
constructor () {
// In Set each object must be unique.
// Adding one thing as dependency multiple times
// adds it only once.
// As `dependency` we understand function that called tracked value.
this.dependencies = new Set();
@soanvig
soanvig / nodejs-ransomware.md
Last active December 16, 2021 19:00
Node.js ransomware

Node.js, ransomware, what? Node.js virus?

Yeah, sure, why not? Maybe it's not practical, but it's quite interesting. Also, ransomware software is a great example of symmetric and asymmetric cryptography usage.

So let's see how you do it!

@soanvig
soanvig / percentile-background-positions.md
Created December 16, 2021 19:03
How percentile background-position works

Background-position

background-position is CSS rule which is used to position background-image inside background-area (the area of container).

About this rule see its reference.

The theory

In theorem the background-position written as % calculates the position as follows:

isEven = (n) => n == 1 ? false : n == 2 ? true : isEven(n-2); Take recursion in control.

What is a recursion? Why and when use a recursion? How to write recursive function easily? Take this in control!

What is a recursion?

Recursion is when type is defined by itself.
OK, let's proceed to another topi-... What, what do I hear? Not extensive enough? Right!

@soanvig
soanvig / password-security.md
Created February 23, 2022 20:29
Password security

Password security analysis

This blog post should be suitable for both technical and non-technical people.

Users over the world gazillion times per day sign-in to various services using password. On my own, I control over 100 passwords for different access purposes. Let's discover what can go wrong.

Using the same password everywhere

@soanvig
soanvig / xmonad-obs-window-capture
Created July 6, 2022 08:41
XMonad / OBS no window capture fix
If you have XMonad and OBS, and cannot screen-capture window (`XComposite` option in OBS), then this might work for you:
Import `import XMonad.Hooks.EwmhDesktops`
Apply your configuration to function `ewmh`:
`xmonad = ewmh $ def { ... }`
Credits: https://obsproject.com/forum/threads/tiling-window-managers-xcomposite-no-windows-found.34708/#post-262994
@soanvig
soanvig / linux-programs.md
Last active January 21, 2024 22:28
Linux nice programs

GNU Alternatives

  1. top/htop -> bpytop, bottom
  2. ps -> procs
  3. cat -> bat
  4. sed -> sad
  5. find -> fd
  6. du -> ncdu -> gdu

Nice programs