Skip to content

Instantly share code, notes, and snippets.

View AnonymerNiklasistanonym's full-sized avatar
🇺🇦

Niklas AnonymerNiklasistanonym

🇺🇦
View GitHub Profile
{"lastUpload":"2020-12-24T07:08:58.569Z","extensionVersion":"v3.4.3"}
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / simpleCaesarForStrings.py
Created March 2, 2018 13:15
Encrypt and decrypt a given string with a given key number to a list of numbers string which can be recreated by using the same key number again
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def cipher(text, key):
""" From https://stackoverflow.com/a/17984554/7827128 """
return [(c + key) % 256 for c in text.encode('utf8')]
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / hostFile.txt
Last active June 16, 2022 19:12
HostFile-StopDistractions [Works on Android 6 with Blokada v3.4 (https://blokada.org/index.html)]
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / isWordInKontextsensitiveGrammar.js
Created August 16, 2018 17:17
Quick program to find out if a word can be created by a set of rules (originally to test if the context sensitive grammar to the language {a^n b^n c^n|n>0} is correct)
/**
* Extremely and not at all fast way to find if a given word can be created via a given set of rules
*
* Can be used to check if a word can be created with a formal grammar.
* Replace rule set and input to find out.
*
*
* This script does not check if you are using only specific variables/symbols.
* It just checks if the word can be derived to the start symbol.
*
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / extendedEuclideanAlgorithm.js
Created September 9, 2018 14:23
JavaScript calculation with all steps of the ggt/gdc (größter gemeinsamer Teiler/greatest common divisor) with the (extended) euclidean algorithm. Quick script to double check hand calculations for 'simultane Kongruenzen', RSA, ...
#!/usr/bin/env node
'use strict'
/*
* This file contains:
* Methods to run the euclidean algorithm and the extended euclidean algorithm
* and methods to print the calculation steps visually to the console
*
* RUN:
* - node: enter in the console 'node extendedEuclideanAlgorithm.js'
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / notableNoteGetImgs.js
Last active February 28, 2019 05:01
Extract used image resources from a note written in Notable (https://github.com/notable/notable) via a CLI node script
const fs = require('fs')
const colors = require('colors')
/**
* Info option, when true enable performance tracking and other infos
*/
let enableInfo = false
/**
* JSON option, return image paths in JSON format
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / notableNoteToTypora.js
Last active February 28, 2019 05:00
Convert a markdown note written in Notable (https://github.com/notable/notable) to a markdown document readable by another Markdown editor like Typora (https://typora.io/) via a CLI node script
const fs = require('fs')
const path = require('path')
const colors = require('colors')
/**
* Info option, when true enable performance tracking and other infos
*/
let enableInfo = false
/**
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / mergeMdFiles.js
Created February 28, 2019 04:54
Merges Markdown files into one file. (With node and file streams [very fast])
const fs = require('fs')
const colors = require('colors')
/**
* Info option, when true enable performance tracking and other infos
*/
let enableInfo = false
/**
* The new file path
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / duplexScanCreator.sh
Last active March 28, 2019 18:08
Easily scan a double sided document once for every side (just turn the paper stack) through the automatic document feeder and merge with this script these two pdfs to one.
#!/usr/bin/env bash
# Description:
# Easily scan a double sided document once for every side (just turn the paper stack)
# through the automatic document feeder and merge with this script these two pdfs to one.
# Arguments:
# 1) & 2) The paths to the two pdf files that should be combined
# 3) The pdf file name of the combined file
# Example:
# sh .\duplexScanCreator.sh .\DocScan1.pdf .\DocScan2.pdf .\DocScan.pdf
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / multipagePdfToSinglePagePdfs.sh
Last active April 6, 2019 19:53
Convert a multi page PDF file to many single page PDF files (and optionally run a command for every PDF file that will be created)
#!/usr/bin/env bash
# Description:
# Seperate a PDF document into many single page PDF documents
# Arguments:
# 1) The path of the PDF file
# 2) The output directory
# 3) The output file name NAME_%d.pdf
# Get page number