Skip to content

Instantly share code, notes, and snippets.

Avatar
😞
depressed NEET betting on a chance in life

Mika Feiler mkf

😞
depressed NEET betting on a chance in life
View GitHub Profile
@mkf
mkf / data.sh
Created Sep 5, 2020
averaging grouped values, rounding upwards
View data.sh
#!/usr/bin/env bash
unset key
cat data.csv | # reads from data.csv
tail -n +2 | # removes first line
tr -d ' ' | # removes all spaces
cut -d ',' -f1,3 | # takes first and third field
# from here on this program:
# calling the right-hand field (string) the key,
# and the left-hand field (positive integers) the values,
@mkf
mkf / tikz2svg
Last active Apr 24, 2020 — forked from jbenet/tikz2svg
tikz2svg - convert tikz input into svg
View tikz2svg
#!/usr/bin/env python2
#
# author: github.com/jbenet
# license: MIT
#
# tikz2svg: convert tikz input into svg
# depends on:
# - pdflatex: comes with your tex dist
# - pdf2svg: brew install pdf2svg
@mkf
mkf / samy1.sh
Last active Feb 11, 2020
samy1.sh
View samy1.sh
#!/usr/bin/env bash
if [[ $2 != *.sam ]]
then
>&2 echo "The '$2' does not end with .sam"
exit 20
elif [[ ! -f $2 ]]
then
>&2 echo "The .sam is not a file"
exit 21
fi
@mkf
mkf / description_com-smajenterprise-incognitoaway_20191214.md
Last active Dec 14, 2019
The description of "Incognito Away - Disable Incognito Tabs" app from https://play.google.com/store/apps/details?id=com.smajenterprise.incognitoaway&hl=en_US as of 20191214T0612CET. Table below the description says about the app was "Updated December 9, 2017".
View description_com-smajenterprise-incognitoaway_20191214.md

Your Incognito Tab Blocker - Incognito Away.
Incognito Away disables and blocks Incognito Tabs from *Google Chrome*, *Microsoft Edge*, *Brave Browser*, and other browsers (see below).

Once installed, you just need to open the app, and enable a quick setting. That’s it!
From then on, ALL Incognito tabs will be blocked as soon as they are opened – it’s instant.

Update: Incognito Away now supports: Google Chrome, Microsoft Edge, Brave Browser, Iron Browser, Ecosia, Yu Browser and Start Internet Browser.

Give the app a try - you've got nothing to lose ✓
Feel free to give the app a try. You can always get an automatic refund within the first 48 hours! ✓✓✓

@mkf
mkf / passh.sh
Last active Sep 21, 2019
passh, that is: sshpass -d {anonymous pipe from executing $1 with args from the rest of argv}
View passh.sh
#!/usr/bin/env bash
# Created by Michał Krzysztof Feiler in September 2019
# Desired usage example:
# ./passh.sh \; ssh user@host \; pass stdout path/of/passfile
# ( this example uses https://github.com/mkf/pass-stdout )
# ( this script aims to serve this example. so far it is a failure. please help. )
shopt -s expand_aliases
alias narg='[ "$#" -eq 0 ]'
if narg; then
>&2 echo 'Lacking arguments. First argument is supposed to be the delimiter, such as "\;".'
@mkf
mkf / what-is-gpg-and-why-in-pass.md
Last active Sep 1, 2019
What is GPG and why is it used in the password manager "pass"
View what-is-gpg-and-why-in-pass.md

I was just asked what is GPG and why is it used in pass password manager (https://www.passwordstore.org/). I will try to briefly explain everything starting from public-key cryptography. So:

Besides the usual way of encryption, symmetrical encryption, which goes like, you have a password and to encrypt you need that password and to decrypt you need that password, there is also another way, the way of public-key cryptography, assymetrical encryption.

In it, you have two keys, related in a way such that you can hardly guess one from the other, but if you encrypt something with the first of them (called the public key, since the public is free to give any data) it will be only decryptable with the second (called private, since only the recipient should have it).

These algorithms are usually rather slow, so usually it's done like, you generate a random key (usually called session key) for symmetrical encryption and then package data encrypted symmetrically with it, along with just that small key encrypted wi

View keybase.md

Keybase proof

I hereby claim:

  • I am mikrfe on github.
  • I am mkf (https://keybase.io/mkf) on keybase.
  • I have a public key ASBNwo_c8zxwsmYbl7P5xGj5NkcmREBL7SNzWqAZXTfhRgo

To claim this, I am signing this object:

View swapreplace.pl
nth([],_,_) :- !, fail.
nth([X],0,X).
nth([_],0,_) :- !, fail.
nth([X|_],0,X).
nth([_|_],0,_) :- !, fail.
nth([_|Rest],Index,X) :- NewIndex is Index-1, nth(Rest,NewIndex,X), !.
onpos(B,[I],X) :- nth(B,I,X).
onpos(B,[I|R],X) :- nth(B,R,A), !, onpos(A,R,X), !.
%onpos(Board,[Rank, File],X) :- nth(Board,Rank,Elements), !, % if we have the nth rank already, there is no other nth rank in Board
% nth(Elements, File, X), !.
View gist:51f8d2541d58da7479c8f778160925fc
mf  ~  java -Dorg.slf4j.simpleLogger.defaultLogLevel=TRACE -jar Pobrane/wallet-key-tool-1.4.2.jar
[Thread-0] INFO prof7bit.bitcoin.wallettool.core.WalletKeyTool - trying import strategy WalletDumpHandler
[Thread-0] DEBUG prof7bit.bitcoin.wallettool.fileformats.WalletDumpHandler - trying to read file: /home/mf/wallet.aes.json
[Thread-0] INFO prof7bit.bitcoin.wallettool.core.WalletKeyTool - WalletDumpHandler said: file did not contain any keys
[Thread-0] TRACE prof7bit.bitcoin.wallettool.core.WalletKeyTool - attempt to use WalletDumpHandler failed
java.lang.Exception: file did not contain any keys
at prof7bit.bitcoin.wallettool.fileformats.WalletDumpHandler.readLines(WalletDumpHandler.java:168)
at prof7bit.bitcoin.wallettool.fileformats.WalletDumpHandler.readUnencrypted(WalletDumpHandler.java:96)
at prof7bit.bitcoin.wallettool.fileformats.WalletDumpHandler.load(WalletDumpHandler.java:54)
at prof7bit.bitcoin.wallettool.core.WalletKeyTool.tryLoadWithStrategy(WalletKeyTool.java:
@mkf
mkf / mmih.go
Created Aug 6, 2017
miscale-manual-input-helper
View mmih.go
package main
import (
"bufio"
"encoding/csv"
"errors"
"fmt"
"os"
"regexp"
"strconv"