Notes
This is a place for some personal notes. I try to use the zettelkasten method. Thats should help me to summarize all the input that Iâm reading day by day. My workflow is dead simple with obsidian (nvim) and a synchronised folder to my private nextcloud and a github repository for converting all the notes to a mdBook. On my mobile (iPhone) actually I prefer to use obsidian (mobile) for editing my markdown files and sync these via WebDAV on my Nextcloud.
Interesting knowledges:
Another topic about publishing your notes: digital-garden
See Also
See meta-knowledge for other lists by people who also record stuff on GitHub.
License
Chat bots
Search engine
Block ai crawler on your website
Add some files to your root dir to block ai web crawler from your website.
Add robots.txt
with this content:
User-agent: AdsBot-Google
Disallow: /
User-agent: Amazonbot
Disallow: /
User-agent: anthropic-ai
Disallow: /
User-agent: Applebot
Disallow: /
User-agent: AwarioRssBot
Disallow: /
User-agent: AwarioSmartBot
Disallow: /
User-agent: Bytespider
Disallow: /
User-agent: CCBot
Disallow: /
User-agent: ChatGPT-User
Disallow: /
User-agent: ClaudeBot
Disallow: /
User-agent: Claude-Web
Disallow: /
User-agent: cohere-ai
Disallow: /
User-agent: DataForSeoBot
Disallow: /
User-agent: Diffbot
Disallow: /
User-agent: FacebookBot
Disallow: /
User-agent: FriendlyCrawler
Disallow: /
User-agent: Google-Extended
Disallow: /
User-agent: GoogleOther
Disallow: /
User-agent: GPTBot
Disallow: /
User-agent: img2dataset
Disallow: /
User-agent: ImagesiftBot
Disallow: /
User-agent: magpie-crawler
Disallow: /
User-agent: Meltwater
Disallow: /
User-agent: omgili
Disallow: /
User-agent: omgilibot
Disallow: /
User-agent: peer39_crawler
Disallow: /
User-agent: peer39_crawler/1.0
Disallow: /
User-agent: PerplexityBot
Disallow: /
User-agent: PiplBot
Disallow: /
User-agent: scoop.it
Disallow: /
User-agent: Seekr
Disallow: /
User-agent: YouBot
Disallow: /
Add .htaccess
with this content:
Order Allow,Deny
# Anthropic Claude - https://docs.anthropic.com/en/api/ip-addresses
Deny from 160.79.104.0/23
Deny from 2607:6bc0::/48
# OpenAI ChatGPT - https://platform.openai.com/docs/plugins/bot/ip-egress-ranges
Deny from 23.98.142.176/28
Deny from 40.84.180.224/28
Deny from 13.65.240.240/28
Deny from 20.161.75.208/28
Deny from 52.225.75.208/28
Deny from 52.156.77.144/28
Deny from 40.84.180.64/28
Allow from all
Source: anreiter.at
Prompts
- colouring template (Malvorlage)
coloring book for kids, no detail, outline no colour, <MOTIV>, fill frame, edge to edge, clipart white background --ar 3:2 --style raw --no color
- code changes summary
You are an expert developer specialist in creating commits.
Provide a super concise one sentence overall changes summary of the user \`git diff\` output following strictly the next rules:
- Do not use any code snippets, imports, file routes or bullets points.
- Do not mention the route of file that has been change.
- Simply describe the MAIN GOAL of the changes.
- Output directly the summary in plain text.
- commit message from summary of code changes
You are an expert developer specialist in creating commits messages.
Your only goal is to retrieve a single commit message.
Based on the provided user changes, combine them in ONE SINGLE commit message retrieving the global idea, following strictly the next rules:
- Always use the next format: \`{type}: {commit_message}\` where \`{type}\` is one of \`feat\`, \`fix\`, \`docs\`, \`style\`, \`refactor\`, \`test\`, \`chore\`, \`revert\`.
- Output directly only one commit message in plain text.
- Be as concise as possible. 50 characters max.
- Do not add any issues numeration nor explain your output.
Pass đ
Favorite app on phone, also on terminal is pass.
Troubleshooting
SSH key import on iPhone fails issue Generate your ssh key without following command:
ssh-keygen -t rsa -b 2046 -m PEM -f ./secret.key
VIM/NEOVIM đ
Some useful keybindings and many more for my favorite editor.
Articles
Some interesting blog posts:
- Vim for advanced users
- History and effective use of Vim
- Seems kinda good for macOS kindavim.app
Copilot (docker)
If you wanna try copilot:
docker run --name copilotcontainer -it debian:sid-slim
apt update && apt upgrade -y
apt install -y neovim nodejs git
git clone https://github.com/github/copilot.vim.git ~/.config/nvim/pack/github/start/copilot.vim
vim
# Now in vim type:
# :Copilot setup
# And then hit enter
# The plugin will display a token.
# Open a browser and paste the code on https://github.com/login/device
# After a few moments, the plugin will finish the setup
# Now exit vim
# Exit the container
docker commit copilotcontainer copilot
docker rm copilotcontainer
## All done
# From now on, you can use the copilot container with:
# docker run --rm -it copilot
Source: gibney
Settings
- TypeScript environment Great article to this topic from Jose Alvarez | medium
- Lua config Different stuff from oroques icyphox
Print mapping
:redir! > vim_keys.txt
:silent verbose map
:redir END
Generate random secure string
:r! openssl rand -base64 12
Format json
Reformat json with :%!jq .
Macro
If you record a macro with qa
and forget something, just with qA
you could append some keystrokes to your macro.
Source: A vim guide for advanced user
Registers
To put a register in insert mode, just do CTRL+R <register>
Source: A vim guide for advanced user
Global command
To delete lines with a pattern:
" delete line
:g/useless/d
" make line lowercase
:g/useless/norm gu$
Source: A vim guide for advanced user
Completion
In insert mode:
ctrl+x ctrl+f complete filenames
ctrl+x ctrl+l complete lines
ctrl+r <register> insert text from register (i.e.: . for last text [ctrl+a])
Visual mode
Selects the previous visual
gv
Go to other end of visual block
v_o/v_0
Increment numbers
CTRL-A inc by one
g CTRL-A inc by sequence
2g CTRL-A inc two by sequence
Blockwise motion
d2j delete 2 lines
d<CRL-V>2j delete 2 chars in that column
Ex commands
Run command for regex
:g/regex/ex
Run comman in norm mode
:g/regex/norm f dw
Source: hillelwayne/intermediate-vim
Commands in insert mode
Ctrl-h - delete back one character (just like Backspace)
Ctrl-w - delete back one word
Ctrl-u - delete back to the start of line or the start of current insert
Talking about Insert mode - did you know that you can paste yanked text without moving to Normal mode? You can do that with
Ctrl-r 0
Source: [Jovica - Mastering Vim Quickly #127]
Vim and shell
Run command from vim
:!{cmd}
Read output form command
:r !{cmd}
insert output on line 3:
:3read !curl --silent ifconfig.me
write as input to command
:[range]write !{cmd}
:'<,'>write !python
Source: vim and the shell
Splits
Splits are very useful i.e. in vimdiff. So here some keybindings.
Source: thoughbot.com
Help: :help splits
& :help CRTL-W
More natural splits opening
Open new split panes to right and bottom, which feels more natural than Vimâs default:
set splitbelow
set splitright
Resizing splits
Vimâs defaults are useful for changing split shapes:
"Max out the height of the current split
ctrl + w _
"Max out the width of the current split
ctrl + w |
"Normalize all split sizes, which is very handy when resizing terminal
ctrl + w =
More split manipulation
"Swap top/bottom or left/right split
Ctrl+W R
"Break out current window into a new tabview
Ctrl+W T
"Close every window in the current tabview but the current one
Ctrl+W o
Obsidian
A collection of obsidian specific styling and configurations, that Im using in my vault.
Checkboxes
- [ ] Unchecked
- [X] Checked
- [-] Dropped
- [>] Forward
- [D] Date
- [?] Question
- [/] Half Done
- [+] Add
- [R] Research
- [!] Important
- [i] Idea
- [B] Brainstorm
- [P] Pro
- [C] Con
- [Q] Quote
- [N] Note
- [b] Bookmark
- [I] Information
- [p] Paraphrase
- [L] Location
- [E] Example
- [A] Answer
- [r] Reward
- [c] Choice
- [d] Doing
- [T] Time
- [@] Character / Person
- [t] Talk
- [O] Outline / Plot
- [~] Conflict
- [W] World
- [f] Clue / Find
- [F] Foreshadow
- [H] Favorite / Health
- [&] Symbolism
- [s] Secret
- [x] Regular
- Unchecked
- Checked
- [-] Dropped
- [>] Forward
- [D] Date
- [?] Question
- [/] Half Done
- [+] Add
- [R] Research
- [!] Important
- [i] Idea
- [B] Brainstorm
- [P] Pro
- [C] Con
- [Q] Quote
- [N] Note
- [b] Bookmark
- [I] Information
- [p] Paraphrase
- [L] Location
- [E] Example
- [A] Answer
- [r] Reward
- [c] Choice
- [d] Doing
- [T] Time
- [@] Character / Person
- [t] Talk
- [O] Outline / Plot
- [~] Conflict
- [W] World
- [f] Clue / Find
- [F] Foreshadow
- [H] Favorite / Health
- [&] Symbolism
- [s] Secret
- Regular
Admonitions
[!recite|color-blue] test
Callouts
can callouts be nested?
[!todo] Yes!, they can.
[!example] You can even use multiple layers of nesting.
Firefox
Settings
Make changes in about:config
:
- Deactivate js for pdf preview:
pdfjs.enableScripting = false
- Show tab close button
browser.tabs.tabClipWidth = 1
- Localhost subdomain
network.dns.localDomains
and add the entries (comma separated)
Extensions
- Vimium: vim motion
- uBlock: block ads
- Reedy: read faster
- Mate translate: translate on doubleclick
- Stylus: custom css style (darkmode)
Bash
Hash maps
# -A means associative array (hashmap)
# -r means read-only
declare -A -r FLY_REGIONS=(
["a100-40gb"]="ord"
["a100-80gb"]="mia"
["l40s"]="ord"
)
Source: xeiaso
Some bash file recommendations:
#!/usr/bin/env bash
set -euo pipefail
[[ "${BASH_VERSINFO[0]}" -lt 4 ]] && die "Bash >=4 required"
function installed {
cmd=$(command -v "${1}")
[[ -n "${cmd}" ]] && [[ -f "${cmd}" ]]
return ${?}
}
function die {
>&2 echo "Fatal: ${@}"
exit 1
}
deps=(curl nc dig)
for dep in "${deps[@]}"; do
installed "${dep}" || die "Missing '${dep}'"
done
# Code blocks aren't subshells, so `exit` works as expected
risky-thing || { >&2 echo "risky-thing didn't work!"; exit 1; }
Another pretty nice template: Source
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
trap cleanup SIGINT SIGTERM ERR EXIT
usage() {
cat <<EOF
Usage: $(basename "$0") [-h] [-v] [-f] -p param_value arg1 [arg2...]
Script description here.
Available options:
-h, --help Print this help and exit
-v, --verbose Print script debug info
-f, --flag Some flag description
-p, --param Some param description
EOF
exit
}
cleanup() {
trap - SIGINT SIGTERM ERR EXIT
# script cleanup here
}
setup_colors() {
if [[ -t 2 ]] && [[ -z "${NO_COLOR-}" ]] && [[ "${TERM-}" != "dumb" ]]; then
NOCOLOR='\033[0m' RED='\033[0;31m' GREEN='\033[0;32m' ORANGE='\033[0;33m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' YELLOW='\033[1;33m'
else
NOCOLOR='' RED='' GREEN='' ORANGE='' BLUE='' PURPLE='' CYAN='' YELLOW=''
fi
}
msg() {
echo >&2 -e "${1-}"
}
die() {
local msg=$1
local code=${2-1} # default exit status 1
msg "$msg"
exit "$code"
}
parse_params() {
# default values of variables set from params
flag=0
param=''
while :; do
case "${1-}" in
-h | --help)
usage
;;
-v | --verbose)
set -x
;;
--no-color)
NO_COLOR=1
;;
-f | --flag) # example flag
flag=1
;;
-p | --param) # example named parameter
param="${2-}"
shift
;;
-?*)
die "Unknown option: $1"
;;
*)
break
;;
esac
shift
done
args=("$@")
# check required params and arguments
[[ -z "${param-}" ]] && die "Missing required parameter: param"
[[ ${#args[@]} -eq 0 ]] && die "Missing script arguments"
return 0
}
parse_params "$@"
setup_colors
# script logic here
msg "${RED}Read parameters:${NOCOLOR}"
msg "- flag: ${flag}"
msg "- param: ${param}"
msg "- arguments: ${args[*]-}"
Basic
Books
- Structure and Interpretation of Computer Programs
- Is Parallel Programming Hard, And, If So, What Can You Do About It?
- Interactive Linear Algebra
Atomic design
A programming pattern that divides components into different chemical stages to allow reusability as much as possible. Mostly useful for frontend design.
- Atoms
- Molecules
- Organisms
- âŠ
Source: Brad Frost
Coding style
At the linux kernel guideline are some good advices: The linux kernel - coding style Google have some guidelines for some languages as well. Use positive booleans for better readability, like described here | Google Code health
Principles
- YAGNI
- stop thinking about future possible mutation of your actual requirements, just let it simple
Code review
-
Be kind! People are more receptive to feedback if you assume competence and treat them with respect.Â
-
Focus your comments on the code, not the author. Avoid statements with the word âyouâ which can give the impression that you are judging the person and not the artifact.
-
Explain why you are making the comment. You may be aware of alternatives that are not obvious to the author, or they may be aware of additional constraints.
-
Express the tradeoffs your suggestion entails and take a pragmatic approach to working with the author to achieve the right balance.
-
Approach your role as a guide, not a test grader. Balance giving direct guidance with leaving some degrees of freedom for the author.
-
Consider marking low priority comments with severity like Nit, Optional, or FYI to help the author prioritize the important ones.
Source: Google testing blog
Environment
Development on a virtual-server (docker)
Try to develop my daily projects within the vitualServer with docker and traefik as proxy for localhost.
Source:
General
Software development workflow
Some of my favourite tools and routines I using in my development environment.
Terminal
- Terminal emulator (fast, minimal, gpu based): kitty
- Multiplexer (Window/Session management): TMUX
- Shell: ZSH
Coding (IDE)
Window Management
Password management
- Self-hosted password manager (Browser & App) vaultwarden
Tools
PKM (knowledge base)
GIT Versioning tool for developers
my daily most used commands
Reducing size of git repository with git-replace
For reporitories with a huge history it takes a long time to clone this whole git overhead.
It relativy easy to spilit your history from one commit to a completly other repository.
- Create new repository (destination for your old history)
- Add this repository url to your huge repo:
git remote add project-history C:\repos\git-replace\history
- Create a history branch from your latest commit (first commit of history repo)
git branch history 590f4d3
- Push this branch to history-repo
git push project-history history:main
- Reduce size of main repo
git commit-tree -m "For historic commits, run 'git replace <child-ID> 590f4d3'" "590f4d3~^{tree}" d3bee05dac84c66b7d13f99a5edf790688f51494
git rebase 590f4d3~ --onto d3bee05 --rebase-merges
- Push small size to origin
git push origin main --force-with-lease
- Clone fresh repo and add history repo to main as a branch
git remote add project-history C:\repos\git-replace\history
git fetch project-history
git branch history project-history/main
- Replace a commit from main to history for connection
git replace 92305a9 590f4d3
- Delete replacement
git replace -d 92305a9
Source: andrewlock.net
Articles
Tools
- git-spice - stack branches, keep update
Git bisect
Find a bad commit with git bisect
just run this command on a commit and mark them as git bisect good/bad
checkout another and run again git bisect good/bad
.
git bisect
is able to find your first bad
commit with i.e. git bisect run bin/rails rspec <FILE>
and mark commit good/bad
with the exitcode of your command.
Commit to an older hash
Run: git-amend.sh <older-hash>
hash=$1
git add .
git commit --fixup $hash
# 'GIT_EDITOR=true' makes the rebase non-interactive
GIT_EDITOR=true git rebase -i --autosquash $hash^
Ignoring bulk change commits with git blame (>git 2.23)
Ignore revs after bulk changes (ie style, format) in git blame:
touch .git-blame-ignore-revs # put commit ids here
git config --global blame.ignoreRevsFile .git-blame-ignore-revs # set file as default to ignore
Source: moxio
Highly recommended
The usage of aliases from git plugin/oh-my-zsh: git-plugin zsh-load: zinit
Here are some git commands, that I NOT used daily. Mainly i use the zsh git plugin with all the useful short commands
(alias) like gs # git status
and gcd # git checkout develop
. It is really handy and i love it.
Checkout a subdir of a git repository
$ mkdir pcl-examples
$ cd pcl-examples #make a directory we want to copy folders to
$ git init #initialize the empty local repo
$ git remote add origin -f https://github.com/PointCloudLibrary/pcl.git #add the remote origin
$ git config core.sparsecheckout true #very crucial. this is where we tell git we are checking out specifics
$ echo "examples/*" >> .git/info/sparse-checkout #recursively checkout examples folder
$ git pull --depth=2 origin master #go only 2 depths down the examples directory
Switch to previous branch
git checkout -
-
is an alias for the previous branch
Open all files with conflicts at once
git diff --name-only --diff-filter=U | uniq | xargs $EDITOR
What changed?
git whatchanged â-since=â2 weeks agoâ
Open a branch as new directory
git worktree add ../worktree2 master
git worktree remove ../f_branch_worktree
Search in git history
git rev-list âall | xargs git grep '<YOUR REGEX>' # regex
git rev-list âall | xargs git grep -F '<YOUR STRING>' # non-regex
Learn
JavaScript
NextJS Error
If this error occures:
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed
You just have to drop your .next
dir for fix that.
Use console print
Different type to print to console:
console.log() â For general output of logging information.
console.info() â Informative logging of information.
console.debug() â Outputs a message to the console with the log level debug.
console.warn() â Outputs a warning message.
console.error() â Outputs an error message.
console.assert()
console.count() - count line execution
console.dir() - print object
console.group() - start group
console.groupEnd() - end group
console.memory() - check heap size
console.table() - print tabular data
console.time() - track time
console.timeEnd()
console.trace() - output stack trace
Source: markodenic
React location listener
To trigger events on location change in React, i.e. for integrate tracking code:
import { useEffect } from 'react';
import { useHistory } from 'react-router-dom';
type EtrackWrapperProps = {
et_et: string;
et_pagename: string;
};
declare global {
interface Window {
gtag?: (key: string, trackingId: string, config: { page_path: string }) => void;
et_eC_Wrapper?: (props: EtrackWrapperProps) => void;
}
}
export type PushType = (id: string, pathname: string) => void;
interface TrackingProps {
trackerId: string;
update: PushType;
}
export const useTracking = ({ trackerId, update }: TrackingProps) => {
const { listen } = useHistory();
useEffect(() => {
const unlisten = listen((location) => {
update(trackerId, location.pathname);
});
return unlisten;
}, [trackerId, update, listen]);
};
Kotlin
Optional API
Source: https://4comprehension.com/kotlins-java-util-optional-equivalents/
val x: Int? = 7 // ofNullable()
val result = x
?.let { ... } // map()
?.takeIf { ... } // filter()
?: 42 // orElseGet()
Make
CFLAGS += -Wall -Wextra LDLIBS = -lcurses OBJS = foo.o bar.o baz.o
foo: $(OBJS) $(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
foo.o bar.o: foo.h
clean: rm -f $(OBJS) foo
Maven
Build subproject with dependencies include
mvn clean install -pl [project name] -amd
Change project version
mvn versions:set -DnewVersion=1.1.0 && mvn versions:commit
Postgres
Connect to db via docker
docker run --rm -it --name pgclient jbergknoff/postgresql-client postgresql://<USERNAME>@<HOST-IP>:<PORT>/<DATABASE_NAME>
Speedup queries
- with
Index Cond
instead ofFilter
withCreateAt > ?1 OR (CreateAt = ?1 AND Id > ?2)
, we can do(CreateAt, Id) > (?1, ?2)
- Always use BUFFERS when running an EXPLAIN. It gives some data that may be crucial for the investigation.
- Always, always try to get an Index Cond (called Index range scan in MySQL) instead of a Filter.
- Always, always, always assume PostgreSQL and MySQL will behave differently. Because they do.
Source: mattermost
Coding projects
In general there are some basic topics, you have to check before start a bigger project/application. These decisions are fundamental for the smooth development of a application.
Timestamp/Date persistance
How to deal with timestamps i.e. getting from user inputs? Do we wanna be timezone compatible with clients/users in different timezones? How to get timezone from user in my backend requests?
- persist timestamp and dates always in UTC in your database
- use of ISO8601 date/timestamp formats, but have to keep in mind on calculations
- most important; keep it consistant in your database
Logging/logfile analytics
What and when you should log something to your logfiles. Make a strategy about logging in general, to get information if you need some in your debugging session for a complex problem. Another great idea is, to have an external service to aggregate your logs for each project ie. rollbar. I would prefer to have for each project a aggregation of project wide logs of your application, hosts and client errors.
Internalisation i18n
Its always a good idea to start with an international translation files on your project. Its easy to looking for a phrase in your application and on the other hand its easy to add another language to your application, in case someone join your project with a different language. A great feature I saw on an project, to have a backend portal you get a possibility to edit you translations life for your keys.
Licenses
If you are planning to create a business, you must verify your licenses and dependencies to ensure they comply.
Wording
Create a list of terms that defines a particular aspect of a use-case to ensure all participants are referring to it in the same manner during conversations.
âŠ
[âŠ]
Python
Articles
Rails
Rails is a very cool framework for web-applications and IMO the best for mvp-prototyping and beyond.
Curriculum
Learning from some youtube guys:
- Video Source: Projekt
- Video Source: simple-pm
- Best practises Semicolon&Sons - Best practises I Passing ruby data to javaScript
Articles
- Great note collection from corsego
- devise, hotwire, turbo, darkmode, basics, views
- Some great articles about coding johnnunemaker
- rails, ruby, âŠ
- Great summary about encryption in rails7 corsego
- ActiveRecord Mistakes that slow down your app
- Modularisation (Monolith):
Useful gems for your rails project
- active_link_to - âHelpful method when you need to add some logic that figures out if the link (or more often navigation item) is selected based on the current page or other arbitrary conditionâ
- avo - âAvo is a very custom Content Management System for Ruby on Rails that saves engineers and teams months of development time by building user interfaces and logic using configuration rather than traditional coding; When configuration is not enough, you can fallback to familiar Ruby on Rails code.â
- brakeman - âBrakeman detects security vulnerabilities in Ruby on Rails applications via static analysis.â
- bundler-audit - âbundler-audit provides patch-level verification for Bundled apps.â
- database_consistency - âProvide an easy way to check the consistency of the database constraints with the application validations.â
- devise - âFlexible authentication solution for Rails with Wardenâ
- interactor - âInteractor provides a common interface for performing complex user interactions.â
- local_time - âRails engine for cache-friendly, client-side local timeâ
- meta-tags - âSearch Engine Optimization (SEO) plugin for Ruby on Rails applications.â
- minitest - âminitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarkingâ
- nocheckout - âRails controllers for Stripe Checkout Sessions and Webhooksâ
- nopassword - âNoPassword is a toolkit that makes it easy to implement temporary, secure login codes initiated from peoplesâ web browsers so they can login to Rails applications via email, SMS, CLI, QR Codes, or any other side-channel.â
- og - âObject Graph (Og) is a state of the art ORM system. Og serializes standard Ruby objects to Mysql, Postgres, Sqlite, KirbyBase, Filesystem and more.â
- omniauth-oauth2Â -Â âAn abstract OAuth2 strategy for OmniAuth.â
- overmind - âOvermind is a process manager for Procfile-based applications and tmux.â
- pagy - âAgnostic pagination in plain ruby. It does it all. Better.â
- phlex - âA high-performance view framework optimised for fun.â
- pundit - âObject oriented authorization for Rails applicationsâ
- ransack - âRansack is the successor to the MetaSearch gem. It improves and expands upon MetaSearchâs functionality, but does not have a 100%-compatible API.â
- strong_migrations - âCatch unsafe migrations in developmentâ
- stylecheck - âRuns code style check on Ruby and SCSS files.â
- superform - âA better way to customize and build forms for your Rails applicationâ
- superview - âBuild Rails applications entirely out of Phlex components.â
- view_component - _âA framework for building reusable, testable & encapsulated view components in Ruby on Rails.â
Source: x/pkayokay / shortruby#119
Pattern matching
def extract(**data)
case data
in name: {first:}
puts first
in tags: [first_tag, *_]
puts first_tag
end
end
> extract(name: { first: "Brad", last: "Gessler" })
"Brad"
> extract(tags: ["person", "earthling"] })
"person"
def matcher(**data)
if first = data.fetch(:first)
puts first
elsif data.key?(:tags)
tags = data.fetch(:tags)
if tags.is_a? Array
puts tags.first
end
end
end
Source: fly.io
Colorize logger
module ColorizedLogger
COLOR_CODES = {
debug: "\e[36m", # Cyan
info: "\e[32m", # Green
warn: "\e[33m", # Yellow
error: "\e[31m", # Red
fatal: "\e[35m", # Magenta
unknown: "\e[37m" # White (or terminal default)
}.freeze
RESET = "\e[0m"
def debug(progname = nil, &block)
super(colorize(:debug, progname, &block))
end
def info(progname = nil, &block)
super(colorize(:info, progname, &block))
end
def warn(progname = nil, &block)
super(colorize(:warn, progname, &block))
end
def error(progname = nil, &block)
super(colorize(:error, progname, &block))
end
def fatal(progname = nil, &block)
super(colorize(:fatal, progname, &block))
end
def unknown(progname = nil, &block)
super(colorize(:unknown, progname, &block))
end
private
def colorize(level, message, &block)
"#{COLOR_CODES[level]}#{message || (block && block.call)}#{RESET}"
end
end
Rails.logger.extend(ColorizedLogger)
Test coverage pre-commit hook
To get an positive exit code for pre-commit hook integration you have to add this to your spec config:
# spec/spec_helper.rb
RSpec.configure do |config|
if ENV["TEST_COVERAGE"]
SimpleCov.start "rails" do
spec_paths = ARGV.grep %r{(spec)/\w+}
if spec_paths.any?
file_paths = spec_paths.map { |spec_path| spec_path.gsub(%r{spec/|_spec}, "") }
add_filter do |file|
file_paths.none? do |file_path|
if file.filename.include? "/app/"
file.filename.match?(%r{/app/#{file_path}})
else
file.filename.include?(file_path)
end
end
end
end
minimum_coverage 98.9
minimum_coverage_by_file 81.4
end
else
SimpleCov.start "rails"
end
[...]
Pre-commit hook:
files=$(git --no-pager diff --name-only --cached --diff-filter=AM)
erbfiles=$(echo "$files" | grep -e '\.html.erb$')
[[ -n "$specfiles" ]] && (TEST_COVERAGE=true bundle exec rspec "$specfiles" || exit 1)
before_action wrapper
class User::LikesController < ApplicationController
abort_without_feature :like
must_have_feature :like
requires_feature :like
end
# app/controllers/concerns/requires_feature.rb
module RequiresFeature
def requires_feature(name, from: :user, **)
before_action(-> { head :bad_request unless Flipper.enabled?(name, Current.public_send(from)) }, **)
end
end
Source: buttondown
Rails ERD
For creating an erd diagram of your db schema, you could create a pdf with: rails-erd with this command:
bundle exec rails erd attributes=foreign_keys,primary_keys,timestamps,content notation=bachman
Race conditions
Avoid race conditions with ActiveRecord::Base.transaction do
and Model.lock.find(model_id)
or my_model_object.lock!
Source: fastruby.io
Migration from sidekiq to solid_queue
Step 1: Update Gemfile
# Remove Sidekiq
# gem 'sidekiq'
# Add Solid Queue
gem 'solid_ queue'
Step 2: Run bundle install
# $ bundle install
Step 3: Generate Solid Queue installation files
# $ rails generate solid_queue:install
Step 4: Run migrations
# $ rails db:migrate
Step 5: Update config/application.rb
# Rails.application.configure do
# config.active_job.queue_adapter = :solid_queue
# end
Step 6: Remove Sidekiq initializer
# Delete or comment out config/initializers/sidekiq.rb
Step 7: Update worker process command in Profile or deployment scripts
# Old: worker: bundle exec sidekiq
# New: worker: bundle exec rails solid_queue: start
Step 8: Remove Redis configuration related to Sidekiq
# Check config/redis.yml or any Redis initializers
Step 9: Update any Sidekiq-specific code in your jobs
Before:
# class MyJob
# include Sidekiq: :Worker
# def perform(args)
# job logic
# end
# end
After:
# class MyJob < ApplicationJob
# queue_as: default def perform(args)
# job logic
# end
Step 10: Update any Sidekiq-specific API calls
# Before: Sidekiq:: Client.push( 'class' => MyJob,
# After: MyJob. perform_later (1, 2, 3)
Step 11: Set up Mission Control (optional)
# In Gemfile:
gem 'mission_control-jobs'
# In config/routes.rb:
Rails.application.routes.draw do
mount MissionControl::Jobs::Engine, at: "/jobs"
end
Step 12: Remove any Sidekiq web UI routes
# Delete or comment out in config/routes.rb:
# require 'sidekiq/web'
# mount Sidekiq:: Web => '/sidekiq'
Responsible monkeypatch
Hereâs the list of rules I try to follow:
- Wrap the patch in a module with an obvious name and useÂ
Module#prepend
 to apply it - Make sure youâre patching the right thing
- Limit the patchâs surface area
- Give yourself escape hatches
- Over-communicate
# ActionView's date_select helper provides the option to "discard" certain
# fields. Discarded fields are (confusingly) still rendered to the page
# using hidden inputs, i.e. <input type="hidden" />. This patch adds an
# additional option to the date_select helper that allows the caller to
# skip rendering the chosen fields altogether. For example, to render all
# but the year field, you might have this in one of your views:
#
# date_select(:date_of_birth, order: [:month, :day])
#
# or, equivalently:
#
# date_select(:date_of_birth, discard_year: true)
#
# To avoid rendering the year field altogether, set :render_discarded to
# false:
#
# date_select(:date_of_birth, discard_year: true, render_discarded: false)
#
# This patch assumes the #build_hidden method exists on
# ActionView::Helpers::DateTimeSelector and accepts two arguments.
#
module RenderDiscardedMonkeypatch
class << self
EXPIRATION_DATE = Date.new(2021, 8, 15)
def apply_patch
if Date.today > EXPIRATION_DATE
puts "WARNING: Please re-evaluate whether or not the ActionView "\
"date_select patch present in #{__FILE__} is still necessary."
end
const = find_const
mtd = find_method(const)
# make sure the class we want to patch exists;
# make sure the #build_hidden method exists and accepts exactly
# two arguments
unless const && mtd && mtd.arity == 2
raise "Could not find class or method when patching "\
"ActionView's date_select helper. Please investigate."
end
# if rails has been upgraded, make sure this patch is still
# necessary
unless rails_version_ok?
puts "WARNING: It looks like Rails has been upgraded since "\
"ActionView's date_select helper was monkeypatched in "\
"#{__FILE__}. Please re-evaluate the patch."
end
# actually apply the patch
const.prepend(InstanceMethods)
end
private
def find_const
Kernel.const_get('ActionView::Helpers::DateTimeSelector')
rescue NameError
# return nil if the constant doesn't exist
end
def find_method(const)
return unless const
const.instance_method(:build_hidden)
rescue NameError
# return nil if the method doesn't exist
end
def rails_version_ok?
Rails::VERSION::MAJOR == 6 && Rails::VERSION::MINOR == 1
end
end
module InstanceMethods
# :render_discarded is an additional option you can pass to the
# date_select helper in your views. Use it to avoid rendering
# "discarded" fields, i.e. fields marked as discarded or simply
# not included in date_select's :order array. For example,
# specifying order: [:day, :month] will cause the helper to
# "discard" the :year field. Discarding a field renders it as a
# hidden input. Set :render_discarded to false to avoid rendering
# it altogether.
def build_hidden(type, value)
if @options.fetch(:render_discarded, true)
super
else
''
end
end
end
end
RenderDiscardedMonkeypatch.apply_patch
Source: appsignal/blog
RSpec
Bisect flaky tests
with rspec --bisect <file>
you could find flaky test setting to re-run it.
hint
If rspec
exits with 1
if suite passes, try untilpass() { until "$@"; do :; done }
and run it with untilpass rspec ...
Testing an array with attributes
expect(items[0].id).to eql(1)
expect(items[0].name).to eql('One')
expect(items[1].id).to eql(2)
expect(items[1].name).to eql('Two')
expect(items[0]).to have_attributes(id: 1, name: 'One')
expect(items[1]).to have_attributes(id: 2, name: 'Two')
expect(items).to match_array([
have_attributes(id: 1, name: 'One'),
have_attributes(id: 2, name: 'Two'),
])
Source: benpickles
Custom matcher
RSpec::Matchers.define :have_errors_on do |attribute|
chain :with_message do |message|
@message = message
end
match do |model|
model.valid?
@has_errors = model.errors.key?(attribute)
if @message
@has_errors && model.errors[attribute].include?(@message)
else
@has_errors
end
end
failure_message_for_should do |model|
if @message
"Validation errors #{model.errors[attribute].inspect} should include #{@message.inspect}"
else
"#{model.class} should have errors on attribute #{attribute.inspect}"
end
end
failure_message_for_should_not do |model|
"#{model.class} should not have an error on attribute #{attribute.inspect}"
end
end
# usage
describe User do
before { subject.email = "foobar" }
it { should have_errors_on(:email).with_message("Email has an invalid format") }
end
Data class
Similiar to the value-alike objects in ruby(3.2), here an example for rails:
class DataClass
ATTRIBUTES = %i[first_name last_name city zipcode phone_number].freeze
include ActiveModel::Model
attr_accessor *ATTRIBUTES
def ==(object)
ATTRIBUTES.all? { |attribute| public_send(attribute) == object.public_send(attribute) }
end
end
ConsumerClass.new(DataClass({first_name: "Bill", last_name: "...", ...}))
Links: Polyfill - Data gem
RSpec factory trait & transient
FactoryBot.define do
factory :user, class: User do
trait :with_book do
transient do
# đŠ1. default value when you use :with_book trait
# đŠ2. Dont't assign just 'Agile'. see also: https://thoughtbot.com/blog/deprecating-static-attributes-in-factory_bot-4-11
title { 'Agile' }
end
after(:build) do |user, evaluator|
user.book = FactoryBot.create(:book, title: evaluator.title)
end
end
end
factory :book, class Book do
sequence(:title) { |n| "book no.#{n}" } # đŠ default value
end
end
# usage
let!(:user) { create(:user, :with_book, title: 'Ruby') }
Source: dev.to/n350071
RailsWorld2023
Some notes on talks:
- Turbo morphing
- new feature for keep scrolling position on whole dom body change
- no-build / bun
- key goal to eliminate build time for frontend stuff, ship as code
- if assignment block
def test 42 end if a = test puts "Assign #{a}" else puts "Nil is return" end
- Class.method(:name).source_location
- get code location of a method
- Model attribute strict_loading prohibit loading relations
- Migration add_column :virtual
create_table :users do |t|
t.numeric :height_cm
t.virtual :height_in, type: :numeric, as: 'height_cm / 2.54', stored: true
end
- Model with_options relations
class User
with_options dependent: :destroy do |options|
options.has_many :tasks, class_name: "UserTask"
options.has_many :addresses
end
end
- try(:method_name) || default_method
- Routing constraints
- subdomain
- authenticated
- Routes draw split into files
- rails generate generator ApiClient
- String truncate_words with omission
- DateTime before? past? future?
- Time.current.all_day .all_week âŠ
- Abbreviation number_to_human() round_mode significant format units
Professional Ruby on Rails Developer with Rails 5
Some notes while doing the udamy course and some ruby notes:
Basics
Render plain text:
def hello
render plain: "hello world!"
end
Create a controller with a method and use a object in view:
# controller
class TodosController < ApplicationController
def new
@todo = Todo.new
end
end
# view
<%= form_for @todo do |f| %>
<% end %>
Use flash
for notifications:
#controller
@todo.save
flash[:notice] = "Todo was created successfully"
# view
<% flash.each do |name, msg| %>
<ul>
<li><%= msg %></li>
</ul>
<% end %>
A bootstrap styled flash messages:
<div class="row">
<div class="col-md-10 col-md-offset-1">
<% flash.each do |name, msg| %>
<div class="alert alert-<%= name %>">
<a href="#" class="close" data-dismiss="alert">Ă</a>
<%= msg %>
</div>
<% end %>
</div>
</div>
Render partials in view ie a file views/layouts/_messages.html.erb
:
<%= render 'layouts/messages' %>
Before run a method do action:
# controller
before_action :set_todo, only: [:edit, :update, :show, :destroy]
private
def set_todo
@todo = Todo.find(params[:id])
end
def todo_params
params.require(:todo).permit(:name, :description)
end
# permit has_many list
def recipe_params
params.require(:recipe).permit(:name, :description, ingredient_ids: [])
end
end
Add pg to production for ie. heroku deployment:
group :production do
gem 'pg'
end
bundle install --without production
Some simple validations:
validates :name, presence: true
validates :description, presence: true, length: { minimum: 5, maximum: 500 }
Application helpers:
helper_method :current_chef, :logged_in?
def current_chef
@current_chef ||= Chef.find(session[:chef_id]) if session[:chef_id]
end
def logged_in?
!!current_chef
end
def require_user
if !logged_in?
flash[:danger] = "You must be logged in to perform that action"
redirect_to root_path
# also possible
redirect_to :back
end
end
Render partial for model:
# View
<% if recipe.ingredients.any? %>
 <p>Ingredients: <%= render recipe.ingredients %></p>
<% end %>
# Now create a new partial _ingredient.html.erb under the app/views/ingredients folder for this to work
<span class="badge"><%= link_to ingredient.name,Â
           ingredient_path(ingredient) %>  </span>
Model
Order models by column:
# order by updated_at -> top of model
default_scope -> { order(updated_at: :desc) }
Get just the last 20 entries of a model
def self.most_recent
order(:created_at).last(20)
end
Routes
Set root route:
# router.rb
root "pages#home"
Specific route to controller#method:
get '/about', to: 'pages#about'
Nested routes:
resources :recipes do
 resources :comments, only: [:create]
end
# Form in view
<%= form\_for(\[@recipe, @comment\], :html => {class: "form-horizontal",Â
                        role: "form"}) do |f| %>
Links
Create links in views:
<%= link_to "Edit this todo", edit_todo_path(@todo) %>
<%= link_to "Back to todos listing", todos_path %>
<td><%= link_to 'delete', todo_path(todo), method: :delete, data: { confirm: "Are you sure?"} %></td>
<%= link_to "MyRecipes", root_path, class: "navbar-brand", id: "logo" %>
<%= link_to "Sign up or log in", "#" class: "btn btn-danger btn-lg" %>
Tests
Create integration test for model:
rails generate integration_test recipes
Simple test root path:
test "should get home" do
get pages_home_url
assert_response :success
end
test "should get root" do
get root_url
assert_response :success
end
to fix this tests, do:
root "pages#home"
get 'pages/home', to: 'pages#home'
# controller
class PagesController < ApplicationController
def home
end
end
Test a simple validation:
require 'test_helper'
class RecipeTest < ActiveSupport::TestCase
def setup
@recipe = Recipe.new(name: "vegetable", description: "great vegetable recipe")
end
test "recipe should be valid" do
assert @recipe.valid?
end
test "name should be present" do
@recipe.name = " "
assert_not @recipe.valid?
end
test "description should be present" do
@recipe.description = " "
assert_not @recipe.valid?
end
test "description shouldn't be less than 5 characters" do
@recipe.description = "a" * 3
assert_not @recipe.valid?
end
test "description shouldn't be more than 500 characters" do
@recipe.description = "a" * 501
assert_not @recipe.valid?
end
test "should get recipes show" do
get recipe_path(@recipe)
assert_template 'recipes/show'
assert_match @recipe.name, response.body
assert_match @recipe.description, response.body
assert_match @chef.chefname, response.body
end
test "should get recipes listing" do
get recipes_path
assert_template 'recipes/index'
assert_select "a[href=?]", recipe_path(@recipe), text: @recipe.name
assert_select "a[href=?]", recipe_path(@recipe2), text: @recipe2.name
end
end
Test a email validation:
require 'test_helper'
class ChefTest < ActiveSupport::TestCase
def setup
@chef = Chef.new(chefname: "mashrur", email: "mashrur@example.com")
end
test "should be valid" do
assert @chef.valid?
end
test "name should be present" do
@chef.chefname = " "
assert_not @chef.valid?
end
test "name should be less than 30 characters" do
@chef.chefname = "a" * 31
assert_not @chef.valid?
end
test "email should be present" do
@chef.email = " "
assert_not @chef.valid?
end
test "email should not be too long" do
@chef.email = "a" * 245 + "@example.com"
assert_not @chef.valid?
end
test "email should accept correct format" do
valid_emails = %w[user@example.com MASHRUR@gmail.com M.first@yahoo.ca john+smith@co.uk.org]
valid_emails.each do |valids|
@chef.email = valids
assert @chef.valid?, "#{valids.inspect} should be valid"
end
end
test "should reject invalid addresses" do
invalid_emails = %w[mashrur@example mashrur@example,com mashrur.name@gmail. joe@bar+foo.com]
invalid_emails.each do |invalids|
@chef.email = invalids
assert_not @chef.valid?, "#{invalids.inspect} should be invalid"
end
end
test "email should be unique and case insensitive" do
duplicate_chef = @chef.dup
duplicate_chef.email = @chef.email.upcase
@chef.save
assert_not duplicate_chef.valid?
end
test "reject an invalid signup" do
get signup_path
assert_no_difference "Chef.count" do
post chefs_path, params: { chef: { chefname: " ",
email: " ", password: "password",
password_confirmation: " " } }
end
assert_template 'chefs/new'
assert_select 'h2.panel-title'
assert_select 'div.panel-body'
end
test "accept valid signup" do
get signup_path
assert_difference "Chef.count", 1 do
post chefs_path, params: { chef: { chefname: "mashrur",
email: "mashrur@example.com", password: "password",
password_confirmation: "password" } }
end
follow_redirect!
assert_template 'chefs/show'
assert_not flash.empty?
end
end
# controller
class Chef < ApplicationRecord
validates :chefname, presence: true, length: { maximum: 30 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 255 },
format: { with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
end
Downcase before save with test:
before_save { self.email = email.downcase }
# And then test it with:
test "email should be lower case before hitting db" do
mixed_email = "JohN@ExampLe.com"
@chef.email = mixed_email
@chef.save
assert_equal mixed_email.downcase, @chef.reload.email
end
Create a association and test it:
Association
# chef model
validates :chef_id, presence: true
has_many :recipes
# recipe model
belongs_to :chef
# destroy with dependent
has_many :recipes, dependent: :destroy
Test
def setup
@chef = Chef.create!(chefname: "mashrur", email: "mashrur@example.com")
@recipe = @chef.recipes.build(name: "vegetable", description: "great vegetable recipe")
end
test "recipe without chef should be invalid" do
@recipe.chef_id = nil
assert_not @recipe.valid?
end
Styling
Add bootstrap
to project (good html/css tutorial link):
gem 'bootstrap-sass', '~> 3.3.7'
gem 'jquery-rails'
# app/assets/javascripts/application.js
//= require bootstrap-sprockets
# app/assets/stylesheets/custom.css.scss
@import "bootstrap-sprockets";
@import "bootstrap";
Views
Render html for each data:
<%= f.collection_check_boxes :ingredient_ids,Â
                  Ingredient.all, :id, :name do |cb| %>
<% cb.label(class: "checkbox-inline input_checkbox") {cb.check_box(class: "checkbox") + cb.text} %>
   <% end %>
Database
Create migration:
rails generate migration create_recipes
# modify the migration file
rails db:migrate
Rename column:
rename_column :recipes, :email, :description
rails db:migrate
Many to many association:
# Model
has_many :recipe_ingredients
has_many :recipes, through: :recipe_ingredients
Articles
- Using the url as a state management jacobparis
Prevent useEffect render on mount
Create a custom useEffect hook
import { DependencyList, EffectCallback, useEffect, useRef } from 'react';
export function useDidUpdateEffect(
effect: EffectCallback,
deps?: DependencyList
) {
// a flag to check if the component did mount (first render's passed)
// it's unrelated to the rendering process so we don't useState here
const didMountRef = useRef(false);
// effect callback runs when the dependency array changes, it also runs
// after the component mounted for the first time.
useEffect(() => {
// if so, mark the component as mounted and skip the first effect call
if (!didMountRef.current) {
didMountRef.current = true;
} else {
// subsequent useEffect callback invocations will execute the effect as normal
return effect();
}
}, deps);
}
Source: stackoverflow
Wrap component into custom one
A better way to customize third-party components, create a custom one with your customizations and use it, instead of copy-paste customizations everywhere.
import * as React from 'react';
import { ReactNode } from 'react';
import { Link, LinkProps } from '@chakra-ui/react';
type VariantType = 'primary' | 'secondary';
type Props = {
variant?: VariantType;
children: ReactNode;
} & Pick<LinkProps, 'href'>;
export const LinkComponent = ({ variant = 'primary', children, ...props }: Props) => {
return (
<Link variant={variant} {...props}>
{children}
</Link>
);
};
Ruby
Some interesting ressources for the programming language ruby.
Books
Interesting
RVM SSL errors
Install again with:
rvm install 3.0.2 --with-openssl-dir=`brew --prefix openssl`
If you got You must recompile Ruby with OpenSSL support
on Mac ARM (M1) you have to:
brew uninstall openssl@3
brew reinstall openssl@1.1
#open new shell
rvm reinstall "ruby-3.0.0" --with-openssl-dir=`brew --prefix openssl@1.1` --disable-binary
On arch you have to install openssl-1.0 and run:
PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig:/usr/lib/pkgconfig rvm install <ruby-version>
Merge hashes
# Turn a collection of hashes into a single one
{ "yellow" => "#FFBEOB" },
{ "orange" => "#FB5607" },
{ "pink" => "#FF006E" }
1. reduce ({},:merge)
#=>â"yellow"=>"#FFBEOB"ïŒ "orange"=>"#FB5607"ïŒ "pink"=>"#FF006E"ïœ
{}.merge(hash1, hash2, hash3) # works as well
Useful functions
Some ruby
functions:
truncate(recipe.description, length: 150) # truncate
time_ago_in_words(recipe.created_at) # date
pluralize(count, "apple") # pluralize if count > 1 to apples
Scripting
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'sqlite3'
end
# write ruby code below
...
Lambda composition
Combine lambda blocks together with >>
i.e. to create a new one like TAX_FEE = TAX >> FEE
# List of our individual pricing rules
TAX = ->(val) { val + val*0.05 }
FEE = ->(val) { val + 1 }
PREMIUM = ->(val) { val + 10 }
DISCOUNT = ->(val) { val * 0.90 }
ROUND_TO_CENT = ->(val) { val.round(2) }
# One presenter
PRESENT = ->(val) { val.to_f }
# Pre-define some rule sets for some pricing scenarios
REGULAR_SET = [FEE, TAX, ROUND_TO_CENT, PRESENT]
PREMIUM_SET = [FEE, PREMIUM, TAX, ROUND_TO_CENT, PRESENT]
DISCOUNTED_SET = [FEE, DISCOUNT, TAX, ROUND_TO_CENT, PRESENT]
Now we can define a price calculator:
def apply_rules(rules:, base_price:)
rules.inject(:>>).call(base_price)
end
Source: get-around.tech
Object lookup
module GildedRose
DEFAULT_CLASS = Item
SPECIALIZED_CLASSES = {
'normal' => Normal,
'Aged Brie' => Brie,
'Backstage passes to a TAFKAL80ETC concert' => Backstage }
def self.for(name, quality, days_remaining)
(SPECIALIZED_CLASSES[name] || DEFAULT_CLASS)
.new(quality, days_remaining)
end
end
Match data
class MatchData
alias_method :deconstruct, :to_a
def deconstruct_keys(keys)
named_captures.transform_keys(&:to_sym).slice(*keys)
end
end
IP_REGEX = /
(?<first_octet>\d{1,3})\.
(?<second_octet>\d{1,3})\.
(?<third_octet>\d{1,3})\.
(?<fourth_octet>\d{1,3})
/x
'192.168.1.1'.match(IP_REGEX) in {
first_octet: '198',
fourth_octet: '1'
}
# => true
Source: dev.to/baweaver
Case for array items:
def process (input)
case input
in []
:empty
in [*] if input.all?(Order)
:has_only_orders
in [*] if input.all? (Payment)
:has_only_payments
else
end
Refinement
Extend/overwrite string behavior in module (specific scope)
module PatchedString
refine String do
def +(value)
self << ", #{value}"
end
end
end
module RegularNamespace
def self.append_strings(a, b)
a + b
end
end
module PatchedNamespace
using PatchedString
def self.append_strings(a, b)
a + b
end
end
RegularNamespace.append_strings("1", "2") # => "12"
PatchedNamespace.append_strings("1", "2") # => "1, 2"
Rust notes
Learning
TODO:
- wasm tutorial -> linuxfoundation
- Crossplatform desktop app -> css-tricks
Wrapper types
Box This abstraction is a low cost abstraction for dynamic allocation. If you want to allocate some memory on the heap and safely pass a pointer to that memory around, this is ideal.
Rc is a reference counted pointer for multiple owning.
Source: Wrapper types
Articles
- Some nice tipps & tricks from federicoterzi
- Great google book for learning rust in 3 days (android) google
Error handling
Rusts result type is a great construct for creating error chains, something like:
#![allow(unused)] fn main() { fn read_config_file(path: &str) -> Result<String, ConfigFileError> { std::fs::read_to_string(path) .map_err(ConfigFileError::ReadError) } fn parse_config_file(file: String) -> Result<i32, ConfigFileError> { file.parse() .map_err(ConfigFileError::ParseError) } fn work_with_config_file(path: &str) -> Result<i32, ConfigFileError> { // No ? required at all - just directly return // the Result, since the types match! read_config_file(path).and_then(parse_config_file) // .and_then(something_else).and_then(even_more_things) .... } }
Source: naiveai, bruntsushi
TypeScript
Enum map specific values
enum Size {
small = 'small',
middle = 'middle',
large = 'large',
}
type SizeMapType<T> = { [key in Size]?: T } & { default: T };
// alternativly something like
// type SizeMapType<T> = Partial<Record<Size, T>>;
const SizeSpecificValue: SizeMapType<Number> = {
[Size.small]: 12,
[Size.middle]: 22,
[Size.large]: 32,
default: 0
}
// fetch data from api and map to enum
const sizeFromApi = Size.middle
const value = SizeSpecificValue[sizeFromApi] || SizeSpecificValue.default
Equipment
Here are a collection of my most favorite technical apps/devices/configuartions.
Equipment
Hardware - Dell XPS 13 9370 (Arch Linux) - iPhone 7 (MN922ZD/A) - iPad mini
Mechanical keyboard
Actualy using my keychron k2, but sneaking infos about some [[tech/splitkb|splitted one]], i.e. Ferris sweep or some better one from mb for DIY.
Operating system (đ)
Arch Linux: - Alacritty (terminal emulator) - Btrfs (filesystem) - Dmenu (launcher) - Firefox (browser) - NeoVim (texteditor) - Neomutt (email client) - Nextcloud (cloud) - Pass (password-manager) - Polybar (statusbar) - Ranger (file manager) - Spotify (music) - Telegram (messeging) - Visual Studio code (editor) - i3 (tiling window manager)
iPhone
Favorite apps: - Youtube (media) - Duolingo (language learning) - Feedly (RSS-reader) - Firefox (browser) - Google News (news) - Instagram (social) - Nextcloud (cloud) - Pass (password-manager) - Reddit (social) - Spotify (music/podcast) - Strava (sport tracking) - TV Time (series tracking) - Telegram/WhatsApp (messenger) - Tomorrow (banking) - Twitter (social) - Wireguard (vpn) - Wunderlist (todo list) - Pocket (readinglist)
What Filesystem Should I Use Today?
Do you want to guarantee your data is free of corruption?
ZFS for your data you care about (/home
) and XFS on LVM for anything else.
Do you want to avoid mucking about with kernel modules?
XFS on LVM
Use btrfs on your root (/
) volume. But at least make /home xfs.
And have backups. borg backup is good.
Source: blackhats.net.au
Secure your VPS
- Updated your serverâs software to the latest version
$ sudo apt update
$ sudo apt upgrade
$ sudo adduser username
$ sudo usermod -aG sudo username
$ su - username
$ sudo whoami
- Disabled password authentication and set up a more secure key-based authentication mechanism
$ ssh-keygen -t ed25519 -C "email@example.com"
$ ssh-copy-id -i ~/.ssh/ed25519.pub username@12.34.56.78
$ ssh -i ~/.ssh/ed25519 -o PasswordAuthentication=no username@12.34.56.78
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/ed25519
$ ssh username@12.34.56.78
alias ssh-vps='ssh username@12.34.56.78'
$ source ~/.zhsrc
- Added a firewall to control access to your serverâs ports
$ ssh username@12.34.56.78
$ sudo vim /etc/ssh/sshd_config
PermitRootLogin no
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
$ sudo service sshd reload
$ ssh root@12.34.56.78
- Installed Fail2Ban to automatically block IP addresses making unauthorised connection attempts
$ sudo apt install ufw
$ sudo ufw status verbose
$ sudo ufw disable
$ sudo ufw app list
$ sudo ufw allow 'OpenSSH'
$ sudo ufw show added
ufw allow OpenSSH
$ sudo ufw default deny incomingÂ
$ sudo ufw default allow outgoing
$ sudo ufw allow 'Nginx Full'
$ sudo ufw enable
$ sudo ufw status verbose
- Configured automatic security upgrades and patches
$ sudo apt install fail2ban
$ sudo systemctl status fail2ban.service
â fail2ban.service - Fail2Ban Service
Loaded: loaded (/lib/systemd/system/fail2ban.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:fail2ban(1)
$ cd /etc/fail2ban
$ sudo cp jail.conf jail.local
$ sudo vim jail.local
[sshd]
enabled = true
mode = aggressive
...
$ sudo systemctl enable fail2ban
$ sudo systemctl start fail2ban
$ sudo systemctl status fail2ban
Source: kkyrie
Apps
https://getkap.co/ - screen recording
https://contao.org/de/
http://www.zentyal.org/
Ninite - Software Installation
Zoneminder - Video Betriebssystem
Froxlor - alt. SysCP
MarkdownPad2
Nfon
Prezi.com
J Language
MS Mathematics
PapDesigner
SOGo/ZAG
Glympse - live Standort mitteilen
speedof.me - html5 speedtest
Bodhi
Hiren's BootCD From USB
ceph
Mirantis
Xming - XServer fĂŒr putty
skjlls.com - eigene Kompetenz in Euro messen
reveal.js - HTML Presentation
Dynv6 - dyndns
Skuawk.com - bildportal
Wallpaper pattern http://subtlepatterns.com/
Audials - rip spotify
ApricityOS
Mattermost - Slack OS alternative
Phacility/Phanricator - PM Tool
HackerOne/BugCrowd/Mutilledae -Security Spiel
scoop - windows shell
tls.imirhil.fr - Cryptocheck
bulma.io - css framework
Zazu - launcher
curl -Ss icanhazip.com - IP Adresse
Mango - markdown editor
Desmos/calculator - graphen
Etcher.io - Bootable Usb
tyyd - share terminal via http
reptyr - transfer process to tmux
wtfutil - personal site in terminal
ulauncher - app launcher
Arch linux
Sway
Full wayland config: fosskers.ca
Packages
Nemo - File Explorer
Seahorse - GUI fĂŒr keyring
alacritty-git # rust terminal emulator
alsa-utils
apvlv
arandr
arc-gtk-theme
archfetch
at
autoconf
autojump
autojump - Terminal directory switch
automake
base-devel - Maketools
bat
bat - cat alternative
bc
bc - bash calculator
bleachbit
calcurse
calcurse - Kalender
compton
cower
dbeaver
diff-so-fancy
dmenu
docker
dunst
exa
exa - ls Ersatz
fd
feh
feh - Bildbeteachtung Bash
file-roller p7zip zip unzip unrar
firefox
fish
font-manager
fzf
fzf - fuzzy finder
gcc
gcc-libs
git
git-flow-completion-git
gitg
gnome-font-viewer
gnome-keyring
gnome-keyring - Passwort Verwaltung
go
gparted
gq
grep
gsimplecal
gucharmap - Font Manager
htop - Prozessexplorer
hugo
i3blocks
i3gaps # window manager
i3status
icdiff
iftop
imagemagick
inetutils
intellij-idea-community-edition
inxi
iputils
make
maven
mc
minitube
ncdu
ncdu - Tree Size
neofetch
neofetch - Bash
neomutt
neovim
neovim - Editor
network-manager-applet
networkmanager
newsboat
nmap
notification-daemon
npm
numlockx
numlockx - Numpad
offlineimap
oh-my-zsh-git
p7zip
pass
pass - Passwortmanager
pass-otp
pass-update
peco
peco - Filertool
polybar-git
prezto-git
pulseaudio
pulseaudio-alsa
pv
pymodoro-git
python-neovim
python-pip
python2-neovim
python2-pip
qtpass
qutebrowser
ranger
ranger - File Explorer
rdesktop
reflector
reflex - run cmd after file change
resty-git
ripgrep
ripgrep - searcher
rofi
rofi-greenclip
rofi-pass-git
rsync
rustup
rxvt-unicode
screenfetch
scrot
shellcheck
simplescreenrecorder
slack-desktop
stow
strace
sublime-text-dev
terminator
terminator - Terminal
termite
thefuck - command correcter
tldr
tldr - short man page
tmux
ttf-iosevka
ttf-iosevka-term
turtl - Notes
ufw
ufw - Firewall
unzip
vim
vimpager
visual-studio-code
wal-git
weechat
wget
wunderline
xarchiver
xclip
xdg-user-dirs
xdg-user-dirs - User folders
xdotool
xss-lock
yay
zathura
zathura-pdf-mupdf
zsh
zsh-syntax-highlighting
10 Things after installation
Source: Average Linux User
Check your current kernel: uname -r
1. Install an LTS kernel and reconfigure grub:
sudo pacman -S linux-lts
sudo grub-mkconfig -o /boot/grub/grub.cfg
You may also install linux-lts-headers. Reboot and check which kernel is in use with uname -r.
Remove non-lts kernel sudo pacman -Rs linux
2. Install Microcode
For intel processors with grub boot loader:
sudo pacman -S intel-ucode
sudo grub-mkconfig -o /boot/grub/grub.cfg
For AMD processors install linux-firmware package.
3. Disable GRUB delay
Add the following to /etc/default/grub: achieve the fastest possible boot:
GRUB_FORCE_HIDDEN_MENU="true"
Then put file 31_hold_shift to /etc/grub.d/. Download 31_hold_shift https://goo.gl/nac6Kp
Make it executable, and regenerate the grub configuration:
sudo chmod a+x /etc/grub.d/31_hold_shift
sudo grub-mkconfig -o /boot/grub/grub.cfg
4. Install some key packages
sudo pacman -S adobe-source-sans-pro-fonts aspell-en enchant gst-libav gst-plugins-good hunspell-en icedtea-web jre8-openjdk languagetool libmythes mythes-en pkgstats ttf-anonymous-pro ttf-bitstream-vera ttf-dejavu ttf-droid ttf-gentium ttf-liberation ttf-ubuntu-font-family
5. Set up firewall
Install ufw:
sudo pacman -S ufw
Enable it.
sudo ufw enable
Check its status:
sudo ufw status verbose
Enable the start-up with the system:
sudo systemctl enable ufw.service
Reboot and check the status again. It should be active.
6. Encrypt your home directory
Logged out. Switch to a console with Ctrl+Alt+F2. Login as a root and check that your user own no processes:
ps -U username
Install the necessary applications:
sudo pacman -S rsync lsof ecryptfs-utils
Then encrypt your home directory:
modprobe ecryptfs
ecryptfs-migrate-home -u username
Mount your encrypted home.
ecryptfs-mount-private
Unwrap the passphrase and save it somewhere where only you can access it.
ecryptfs-unwrap-passphrase
Run
ls .ecryptfs
Edit /etc/pam.d/system-auth:
After the line âauth required pam_unix.soâ add:
auth required pam_ecryptfs.so unwrap
Above the line âpassword required pam_unix.soâ insert:
password optional pam_ecryptfs.so
After the line âsession required pam_unix.soâ add:
session optional pam_ecryptfs.so unwrap
Reboot and make sure that you can login to your desktop
7. Remove orphans
sudo pacman -Rns $(pacman -Qtdq)
8. Optimize pacmanâs database access speeds
sudo pacman-optimize
9. Check for errors
sudo systemctl --failed
sudo journalctl -p 3 -xb
10. Backup the system
sudo rsync -aAXvP --delete --exclude=/dev/* --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* --exclude=/run/* --exclude=/mnt/* --exclude=/media/* --exclude=/lost+found --exclude=/home/.ecryptfs / /mnt/backupDestination/
@linux @bash
Useful oneliners
Show dir sizes: du -hs */ | sort -hr | head
Show ssh key ids
for file in $(fd -e pub); do ssh-keygen -lf $file && echo $file; done
for file in $(fd -e pub); do ssh-keygen -l -E md5 -f $file && echo $file; done
ENV via ssh forward
export MYVAR=test
ssh myhost "export MYVAR='$MYVAR' && echo $MYVAR"
# test
A one-liner version incrementer
inc_version() {
awk -F. -vOFS=. '{ $ver++; while(ver++<NF) $ver=0; print $0 }' ver=$1
}
Source: https://gir.st/blog/inc-version.htm
Reset efivars in bootmenu (bootctl)
To remove LoaderEntryDefault-[âŠ] variable it was enough to press d key twice in the boot menu: to set and unset a new value. To remove LoaderConfigTimeout-[âŠ] variable it turned out enough to press Shift+t enough times to set the timeout to 0, plus one more time. Link
Check dns server for dnssec
With dig +dnssec kuketz-blog.de @116.203.32.217
check for flags, needs to have
the ad
included, for authenticated answer.
Search in .tar.gz files
rg -a -z 'regex'
List open ports
sudo ss -tulpn
sudo netstat -tulpn | grep LISTEN
sudo lsof -i -P -n | grep LISTEN # process list
sudo lsof -i -n -P | grep TCP # macOS
sudo nmap -sT -O localhost # scan localhost
Find file from iNode Number
find ~/ -inum 123456
Start GUI app in background from commandline
<guiapp> . &!
Run last command as root
sudo !!
Serve current dir tree at :8080
Only in python2
python -m SimpleHTTPServer
Python3:
python3 -m http.server
### Replacing in last command
^sub^to
### Supervise command (run every 2s)
watch âls -larthâ
### Kill program using one port
```bash
sudo fuser -k 8000/tcp
Limit memory usage for following commands
ulimit -Sv 1000 # 1000 KBs = 1 MB
ulimit -Sv unlimited # Remove limit
Rename selected files using a regular expression
rename 's/\.bak$/.txt/' *.bak
Get full path of file
readlink -f file.txt
List contents of tar.gz and extract only one file
tar tf file.tgz
tar xf file.tgz filename }}
List files by size
ls -lS
Nice trace route
mtr google.com
Find files tips
find . -size 20c # By file size (20 bytes)
find . -name "*.gz" -delete # Delete files
find . -exec echo {} \; # One file by line
./file1
./file2
./file3
find . -exec echo {} \+ # All in the same line
./file1 ./file2 ./file3
Print text ad infinitum
yes
yes hello
Who is logged in?
w
Prepend line number
ls | nl
Grep with Perl like syntax (allows chars like \t)
grep -P "\t"
Cat backwards (starting from the end)
tac file
Check permissions of each directory to a file
It is useful to detect permissions errors, for example when configuring a web server.
namei -l /path/to/file.txt
Run command every time a file is modified
while inotifywait -e close_write document.tex
do
make
done
Copy to clipboard
cat file.txt | xclip -selection clipboard
Spell and grammar check in Latex
detex file.tex | diction -bs
You may need to install the following sudo apt-get install diction texlive-extra-utils.
Check resourcesâ usage of command
/usr/bin/time -v ls
Randomize lines in file
cat file.txt | sort -R
cat file.txt | sort -R | head # Pick a random sambple
Even better (suggested by xearl in Hacker news):
shuf file.txt
Keep program running after leaving SSH session
If the program doesn't need any interaction
nohup ./script.sh &
If you need to enter some input manually and then want to leave
./script.sh
<Type any input you want>
<Ctrl-Z> # send process to sleep
jobs -l # find out the job id
disown -h jobid # disown job
bg # continue running in the background
Of course, you can also use screen or tmux for this purpose.
Run a command for a limited time
timeout 10s ./script.sh
Restart every 30 minutes
while true; do timeout 30m ./script.sh; done
Combine lines from two sorted files
comm file1 file2
Split long file in files with same number of lines
split -l LINES -d file.txt output_prefix
Flush swap partition
If a program eats too much memory, the swap can get filled with the rest of the memory and when you go back to normal, everything is slow. Just restart the swap partition to fix it:
sudo swapoff -a
sudo swapon -a
Fix ext4 file system with problems with its superblock
sudo fsck.ext4 -f -y /dev/sda1
sudo fsck.ext4 -v /dev/sda1
sudo mke2fs -n /dev/sda1
sudo e2fsck -n <first block number of previous list> /dev/sda1
Create empty file of given size
fallocate -l 1G test.img
Manipulate PDFs from the command line
To join, shuffle, select, etc. pdftk is a great tool
pdftk *.pdf cat output all.pdf # Join PDFs together
pdftk A=in.pdf cat A5 output out.pdf # Extract page from PDF
You can also manipulate the content with cpdf
cpdf -draft in.pdf -o out.pdf # Remove images
cpdf -blacktext in.pdf -o out.pdf # Convert all text to black color
Monitor the progress in terms of generated output
Write random data, encode it in base64 and monitor how fast it is being sent to /dev/null
cat /dev/urandom | base64 | pv -lbri2 > /dev/null
Scrum
Thats the most prefered agile software development method that I mostly worked with in DIFFERENT ways and most of the time, in a bad way (non-productive).
Daily
-
good way:
Everbody talk about their blockers or challenges for the task of that day. Pushes some urgent pull-requests for code-review or ask for clearafications from front-/back-end. Talk about upcoming releases and their open todos.
-
bad way:
Everyone just saying what they did yesterday and whats the plan for that day.
Review
-
good way:
Present something important things or howto for usage of a finished feature to the product owner.
-
bad way:
Everyone summarize the tasks of the finished sprint from own perspective.
Retrospective
-
good way:
Great tool for retrospectives is team-o-clock goretro
-
Step 1 (retro):
Everyone inputs some points into the i.e. following columns.
-
House of straw | House of sticks | House of bricks |
---|---|---|
⊠| ⊠| ⊠|
Start | Stop | Continue |
---|---|---|
⊠| ⊠| ⊠|
Liked | Learned | Lacked | Longed for |
---|---|---|---|
⊠| ⊠| ⊠| ⊠|
-
-
Step 2 (grooming):
Everyone groom this points together (group them if same topic)
-
Step 3 (voting):
Everyone awards 3-5 points in total to their most important topics (points)
-
Step 4 (discussion):
In order to the most important points, everyone explain their point in more detail and discuss together what needs todo.
-
Step 5 (actions):
Collect some actions (todos) and plan them into the next sprint.
-
-
bad way:
Just ask for some complications, mostly without some feedback.
Planning
-
good way:
Create a good plan about the process of the next sprint with related tasks from frontend & backend.
-
bad way:
Just put some tasks into the next sprint and probably assign these to someone.
Refinement
-
good way:
Talk about tasks and pick someone from backend/frontend to make some technical assumptions about a possible approach.
-
bad way:
Just ask about question to some tasks and clearify these in a discussion.
Self-hosting
Im self-hosting some private services, like mailserver, cloud, rss aggregator etc.
Hoster
- contabo - have the smallest VPS for actually 4 Euro/mnth (unbeatable)
Device
If you want to self-host at home, you could get something like this:
Ideas
-
Great article about self-hosting architecture cprimozic
- modern nginx features with different modules
- phost for quick static site self-hosting
- sentry for logging
- httpbin for api testing
- send for private file sharing
- munin for monitoring
- google cloud archive coldline for backup
-
Note taking wiz.cn
-
todo management vikunja
-
host an own music streaming navidrome
-
Host my own signal proxy Help iran to connect signal
-
SMTP backup Mailcatcher Postfix relay config:
Edit the Postfix configuration to specify the desired relaying. Where example.com is your domain, in /etc/postfix/main.cf, set:
relay_domains = example.com relayhost = primary-mx.example.com inet_interfaces = all local_recipient_maps = mynetworks =
Launch Postfix. sudo /etc/init.d/postfix start
-
Web IRC Client the-lounge
-
IT Hardware Management Snap-IT
-
Media Server JellyFin
KNX
DIY
- Blog article for doing it yourself: Kosten senken durch Eigenleistung
- KNX DIY service: Main-Smarthome
# Home-Assistent
Cool stuff
Database correction
Sometimes getting wrong data from my smart meter, that one have to fix in database with the SQlite Web add-on on my home-assistant instance, with following commands:
SELECT *
FROM "statistics" WHERE CAST(mean AS DECIMAL(12,6)) LIKE '3976%'
UPDATE "statistics"
SET mean = OtherTable.Col1,
Col2 = OtherTable.Col2
FROM (
SELECT *
FROM "statistics" WHERE CAST(mean AS DECIMAL(12,6))
LIKE '3976%')
## Audio output on audio-jack
Install following plugin: [MPD](https://github.com/Poeschl/Hassio-Addons/tree/main/mpd)
## Pollenflug
Sensoren anlegen:
```yml
# Pollenflug Informationen
- platform: rest
scan_interval: 3600
name: "DWD Pollen"
resource: https://opendata.dwd.de/climate_environment/health/alerts/s31fg.json
json_attributes_path: "$..content[?(@.partregion_id==42)].Pollen"
json_attributes:
- Erle
- Beifuss
- Ambrosia
- Birke
- Esche
- Hasel
- Graeser
- Roggen
value_template: "{{ value_json.last_update }}"
- platform: template
sensors:
dwd_pollen_erle:
icon_template: "mdi:tree-outline"
friendly_name: "Erle"
value_template: >-
{% set dwd_state = state_attr('sensor.dwd_pollen', 'Erle')['today'] %}
{% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% else %}0{% endif %}
attribute_templates:
today: >-
{% set dwd_state = state_attr('sensor.dwd_pollen', 'Erle')['today'] %}
{% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% else %}0{% endif %}
tomorrow: >-
{% set dwd_state = state_attr('sensor.dwd_pollen', 'Erle')['tomorrow'] %}
{% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% else %}0{% endif %}
Source: youtube/smarthomeyourself
Shutter control
MQTT Slider
Works! Tasmota wiki for covers:
cover:
- platform: mqtt
name: "Wohnzimmer Zentrale"
availability_topic: "Smarthome/jalosien/wohnzimmer/tele/LWT"
payload_available: "Online"
payload_not_available: "Offline"
position_topic: "Smarthome/jalosien/wohnzimmer/stat/SHUTTER1"
position_open: 100
position_closed: 0
set_position_topic: "Smarthome/jalosien/wohnzimmer/cmnd/ShutterPosition1"
command_topic: "Smarthome/jalosien/wohnzimmer/cmnd/BACKLOG"
payload_open: "ShutterOpen1"
payload_close: "ShutterClose1"
payload_stop: "ShutterStop1"
retain: false
optimistic: false
qos: 1
Definition from github snakuzzo:
- platform: mqtt
name: "Wohnzimmer Zentrale"
availability_topic: "Smarthome/jalosien/wohnzimmer/tele/LWT"
state_topic: "stat/sonoff-cletto/RESULT"
command_topic: "Smarthome/jalosien/wohnzimmer/cmnd"
value_template: '{{ value | int }}'
qos: 1
retain: false
payload_open: "ShutterOpen1"
payload_close: "ShutterClose1"
payload_stop: "ShutterStop1"
state_open: "ON"
state_closed: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
optimistic: true
set_position_topic: "Smarthome/jalosien/wohnzimmer/cmnd/shutterposition"
position_topic: "Smarthome/jalosien/wohnzimmer/stat/SHUTTER1"
A definition for slider from community/florian
- platform: mqtt
name: bedroom_cover
command_topic: "shellies/shellyswitch-xxxxxx/roller/0/command"
position_topic: "shellies/shellyswitch-xxxxxx/roller/0/pos"
set_position_topic: "shellies/shellyswitch-xxxxxx/roller/0/command/pos"
availability_topic: "shellies/shellyswitch-xxxxxx/online"
payload_available: "true"
payload_not_available: "false"
qos: 1
retain: false
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
position_open: 100
position_closed: 0
optimistic: false
another one
- platform: mqtt
name: living_room_shutter
availability_topic: "Smarthome/jalosien/wohnzimmer/tele/LWT"
state_topic: "tele/persiana_dormitorio/RESULT"
command_topic: "Smarthome/jalosien/wohnzimmer/cmnd"
set_position_topic: "Smarthome/jalosien/wohnzimmer/cmnd/shutterposition"
value_template: "{{ value_json['SHUTTER-1'] }}"
qos: 1
retain: true
payload_open: "SHUTTEROPEN"
payload_close: "SHUTTERCLOSE"
payload_stop: "SHUTTERSTOP"
state_open: "ON"
state_closed: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
optimistic: true
Automation
- id: '1611493304194'
alias: Jalosien runter bei Sonnenuntergang
trigger:
- platform: sun
event: sunset
offset: +00:30:00
action:
- service: cover.set_cover_position
data:
position: 0
entity_id: cover.wohnzimmer_zentrale
mode: single
- id: '1611863540767'
alias: Jalosien hoch bei Sonnenaufgang
trigger:
- platform: sun
event: sunrise
offset: -00:30:00
action:
- service: cover.set_cover_position
data:
position: 100
entity_id: cover.wohnzimmer_zentrale
mode: single
Security
Interest things for security in general:
Articles:
- Minimum viable secure product mvsp
- Secure your VPS basic#Secure your VPS
Yubikey
Best practice guide: https://github.com/drduh/YubiKey-Guide Another great guide: https://yubikey.jms1.info
Secure password:
LC_ALL=C tr -dc 'A-Z1-9' < /dev/urandom | \
tr -d "1IOS5U" | fold -w 30 | sed "-es/./ /"{1..26..5} | \
cut -c2- | tr " " "-" | head -1
Configuration notes
- Not do
keytocard
of your primary cipher key, this should stay save on your backup media. - Always!!! backup your
$GNUPGHOME
before doingkeytocard
- not saving on quit will drop your keys anyways. - Lint (hopenpgp-tools) your pgp key with:
gpg --export <KEYID> | hokey lint
Error at adding key to agent:
â
â
†ssh-add id_ed25519
Enter passphrase for id_ed25519:
Could not add identity "id_ed25519": agent refused operation
Check path for pinentry-program /opt/homebrew/bin/pinentry-mac
in ~/.gnupg/gpg-agent.conf
Quick commands
gpg --batch --generate-key gen-params-ed25519
gpg --quick-add-key $KEYID ed25519 sign 1y
gpg --quick-add-key $KEYID ed25519 auth 1y
gpg --quick-add-key $KEYID cv25519 encrypt 1y
Security quote
Security is a team sport, and accelerating SFI isnât just job number one for our security teams â itâs everyoneâs top priority and our customersâ greatest need. If youâre faced with the tradeoff between security and another priority, your answer is clear: Do security. In some cases, this will mean prioritizing security above other things we do, such as releasing new features or providing ongoing support for legacy systems. This is key to advancing both our platform quality and capability such that we can protect the digital estates of our customers and build a safer world for all. - Satya
Source: Microsoft(đ) Blog
Passwords
Rotation
warning
A security policy to rotate passwords is a security finding in audits as NIST and BSI classified it.
NIST SP 800-63 Digital Identity Guidelines
- Authenticator and Verifier Requirements
3.1.1.2 Password Verifiers
- [âŠ]
-
- Verifiers and CSPs SHALL NOT require users to change passwords periodically. However, verifiers SHALL force a change if there is evidence of compromise of the authenticator.
Source: nist
ORP.4 IdentitÀts- und Berechtigungsmanagement
- ORP.4.A23 Regelung fĂŒr passwortverarbeitende Anwendungen und ITSysteme (B) [IT-Betrieb] IT-Systeme oder Anwendungen SOLLTEN NUR mit einem validen Grund zum Wechsel des Passworts auffordern.
Source: BSI
Pentest
Polyglot files
With a polyglot file, you re able to compromise a file upload with restricted file-types.
cat beispiel.pdf beispiel.zip > polyglot-pdf.zip
This zip file, will be recognized as a pdf file:
$ file polyglot-pdf.zip
polyglot-pdf.zip: PDF document, [...]
If a backend just checks the content-type
its still PDF
. So if you download this file and get original file as .zip
file and extract it, you will get the pdf & zip file included there.
Split keyboard
For my first try, I build a ferris sweep with Kailh Low Profile Choc Switches, Blank MBK Choc Low Profile Keycaps and two Elite-Pi controllers from splitkb.com.
Some more details about my walkthrough this journey and its actual state:
- Get your ferris sweep pcb, got my from a friend @mberrio
- buy all the components, i.e. here splitkb.com
- solder this on your pcb, howto
After finish the hardware, you have to flash your controllers. For me its two Elite-Pi controllers on my sweep (left & right).
- install qmk and test the first compile
- create a keymap with configurator
- set handedness to elite-pi with
make CONVERT_TO=kb2040 ferris/sweep:default:uf2-split-left
make CONVERT_TO=kb2040 ferris/sweep:default:uf2-split-right
- each command creates a
.uf2
file, that the firmware file for each side to be configured once on each side - plug-in each controller (first time starts in boot mode) and copy
.uf2
to DF2 usb storage (it restarts & flash automatically) - create firmware, i.e. like this
qmk compile -kb ferris/sweep -km default -e CONVERT_TO=elite_pi
- copy created
.uf2
file to each controller
After flashing your have a running ferris sweep split keyboard, which you must now learn to love. Take a lot of time to get to know each other âŠ
Play around with the configurator and create your own keymap.json
file. If you ready to learn, print your keymap here and start typing.
Tools:
- keybr.com
- https://monkeytype.com/
Misc
Some interesting dotfiles:
- https://github.com/webgefrickel/dotfiles #mutt
- https://github.com:frank604/scripts.git
- https://github.com/Northcode/dotfiles.git
- https://github.com:rcr/dotfiles.git
- https://github.com/ReekyMarko/dotfiles
- ishchow - lua
Cool stuff
- ASCII paint asciiflow
- Privacy sexy privacy.sexy
- Youtube (ad-free) piped
- AirDrop snapdrop
- Slide/Prasentation sli.dev
- Multi device for geeks flipper zero
- regex prime check
^.?$|^(..+?)\1+$
explain - paste over cli
curl -T example.yml -H "Content-Type: text/yaml" https://api.pastes.dev/post
- photopea - Photoshop online (free)
Trackers
- series & films: serializd / letterboxd
- books: oku / goodreads
Nix
Articles
- Nix quickstart zero-to-nix
- Tidy up your home with nix
- Github actions with nix
Emacs
Articles
Docker
Show ip addresses of running containers:
docker ps -q | xargs -n 1 docker inspect --format '{{ .NetworkSettings.Networks.frontend.IPAddress }} {{ .Name }}' | sed 's/ \// /'
Raspberry Pi
Show the model in shell cat /sys/firmware/devicetree/base/model
Kubernetes
Some security guidelines for kubernetes (OWASP)
SSH
Articles
For sharing a local dev server for public, great service from localhost.run:
ssh -R 80:localhost:3000 localhost.run
YAML get full path
cat myfile.yml | yq e '.. | select(. == "*") | {(path | join(".")): .} '
Replace passwords in gz
logile
gzip -cd rails.log.gz | sed -re 's/(\"password\"=>)(\"(.*)\",)/\1\"[FILTERed]",/g' | sed -re 's/(\"password_confirmation\"=>)(\"(.*)\")/\1\"[FILTERed]"/g' | gzip > rails.tmp
Link text on a website
Use this syntax to link to specific text:
https://example.com/page.html#:~:text=[prefix-,]textStart[,textEnd][,-suffix]
i.e. this
# highlight
https://developer.mozilla.org/en-US/docs/Web/URI/Fragment/Text_fragments#:~:text=without%20relying%20on%20the%20presence%20of%20IDs
# multiple texts
https://developer.mozilla.org/en-US/docs/Web/URI/Fragment/Text_fragments#:~:text=using%20particular&text=it%20allows
# fragments
https://developer.mozilla.org/en-US/docs/Web/URI/Fragment/Text_fragments#:~:text=using%20particular,don't%20control
Source: alfy.blog
Ed cheatsheet
Navigating
Line number: go to that line and print it.
pn - Print current line and line number.
3kxe - mark line 3 as "xe".
'xep - print the line marked as xe.
Editing
a - start editing after the current line.
i - start editing before the current line.
c - replace the current line.
end the editing with only a period on a line (.).
1d - delete line 1.
1,2j - join line one and two.
Printing
1,$p - print entire buffer.
,p - also prints the entire buffer.
2,3p - print lines 2 and 3.
.,4p - print from the current line (.) to line 4.
-1,+1p - print 1 line above and 1 line below the current line.
Buffer operations
2t4 - Copy line 2 to after line 4.
2t$ - Copy line 2 to the end of the file.
3m6 - Move line 3 to after line 6.
2,4m$ - Move lines 2 to 4 to the end of the file.
Searching / replace
/like - Move to the next line after the current one matching regular expression /like.
?Like - Search backwards.
1s/re/jo - Substitute only the first occurence of re with jo on line 1.
1s/re/jo/g - Substitute all occurences of re with jo on line 1.
1,$s/re/jo/g - Substitute all occurences of re with jo in the whole buffer.
Regular expresions
g/re/p - print all the lines matching regular expression /re/.
v/re/p - print all the lines NOT matching regular expression /re/.
g/re/m$ - move all the lines matching regular expression /re/ to the end of the file.
Reading and writing
w file.txt - Save the current buffer as filename file.txt.
w - Save the current buffer if the file is already saved.
w1,4 - Save lines 1 to 4 to the current buffer.
W - append to a file (not replace).
r /etc/hosts - Insert the contents of /etc/hosts after the current line.
r !ps -e - Insert the output of the command "ps -e" after the current line.
e file.txt - Open the file file.txt and replace the current buffer.
Generate qrcode in terminal
qrencode -m 2 -t utf8 < file.conf
MacOS Brew install older version
- You create a local âtapâ - which I assume is something like a local brew repository
- You extract the desired version of the package into this local tap
- You install your local tap
# use $USER variable to mimick userName/repoName structure
# this does not actually create any git repositories
# 1. create a new tap
brew tap-new $USER/local-<packageName>
# 2. extract into local tap
brew extract --version=1.2.3 <packageName> $USER/local-<packageName>
# 3. run brew install@version as usual
brew install <packageName>@1.2.3
If not found:
# list all local taps
brew tap
# go to tap and check out correct hash
cd /usr/local/Homebrew/Library/Taps/<packageName>
git checkout <hash>
# prevent brew from checking out different hash
HOMEBREW_NO_AUTO_UPDATE=1 brew install <packageName>
# can list and switch between all versions
brew list --versions
brew switch <packageName> <version>
target="_blank"
vulnerability
Add always rel="noopener noreferrer"
to target="_blank"
links, because of:
MacOS
Shutdown without confirmation from terminal:
osascript -e 'tell app "System Events" to shut down'
Source: Stackexchange
Wireguard
Setup wireguard with good explanations: What They Donât Tell You About Setting Up A WireGuard VPN
# Generate keys in /etc/wireguard
cd /etc/wireguard
wg genkey | tee privatekey | wg pubkey > publickey
# /etc/wireguard/wg0.conf on the server
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
# Use your own private key, from /etc/wireguard/privatekey
PrivateKey = WCzcoJZaxurBVM/wO1ogMZgg5O5W12ON94p38ci+zG4=
[Peer]
# VPN client's public key
PublicKey = lIINA9aXWqLzbkApDsg3cpQ3m4LnPS0OXogSasNW5RY=
# VPN client's IP address in the VPN
AllowedIPs = 10.0.0.8/32
Relaying traffic
# /etc/sysctl.conf
net.ipv4.ip_forward=1
# Then apply the settings by running:
sysctl -p
Client config:
# /etc/wireguard/wg0.conf on the client
[Interface]
# The address your computer will use on the VPN
Address = 10.0.0.8/32# Load your privatekey from file
PostUp = wg set %i private-key /etc/wireguard/privatekey
# Also ping the vpn server to ensure the tunnel is initialized
PostUp = ping -c1 10.0.0.1[Peer]
# VPN server's wireguard public key (USE YOURS!)
PublicKey = CcZHeaO08z55/x3FXdsSGmOQvZG32SvHlrwHnsWlGTs=# Public IP address of your VPN server (USE YOURS!)
# Use the floating IP address if you created one for your VPN server
Endpoint = 123.123.123.123:51820# 10.0.0.0/24 is the VPN subnet
AllowedIPs = 10.0.0.0/24# To also accept and send traffic to a VPC subnet at 10.110.0.0/20
# AllowedIPs = 10.0.0.0/24,10.110.0.0/20# To accept traffic from and send traffic to any IP address through the VPN
# AllowedIPs = 0.0.0.0/0# To keep a connection open from the server to this client
# (Use if you're behind a NAT, e.g. on a home network, and
# want peers to be able to connect to you.)
# PersistentKeepalive = 25
NGINX config
Some nginx features for developers.
Redirect a domain to localhost dev server:
user nginx;
worker_processes auto;
events {}
http {
access_log /var/log/nginx/access.log combined;
# include /etc/nginx/conf.d/*.conf;
upstream backend {
server backend.local:10000;
}
server {
server_name proxy.local;
listen 8000;
location / {
proxy_pass http://backend;
}
}
}
Source: Nice nginx features for developers
Compressed response
Using with curl -H 'Accept-encoding: gzip' localhost:8080/ping | gunzip -
or curl --compressed https://ashishb.net
.
Allow Accept-encoding: gzip
with config:
http {
...
server {
...
gzip on;
gzip_min_length 1000;
...
}
}
Source: ashishb.net
FLoC blocking
Block FLoC within traefik:
# traefik.toml
[http.middlewares]
[http.middlewares.floc.headers]
[http.middlewares.floc.headers.customResponseHeaders]
Permissions-Policy = "interest-cohort=()"
Source: Paramdeo Singh - Opting your Website out of Googleâs FLoC Network
Create QR-Code for your wifi
Source qrencode -o wifi.png "WIFI:T:WPA;S:<SSID>;P:<PASSWORD>;;"
Security book
A most recommended it security book: Book
Linux hardening book
How to harden alinux system guide: Book
Custom sortation of database entries
Found an good article about, how handle the custom sortation of entires in sql database. TL;DR just add an column pos
to the table and auto-increment this value. If insert an entry between of some rows, just calculate the new position for this entry like: ((pos n-1 + pos n+1) / 2
i.e.:
| names | pos | | peter | 1 | | tom | 2 | | harry | 2.5 | | ben | 3 |
begriffs.com - User defined order
OWASP 10 most critical security issues for web applications
Some notes of: OWASP Top 10 - heise from Tobias Glemser Authentication: OWASP Authentication Cheat sheet
Content:
- EinfĂŒhrung in relevante Organisationen
- Beispiele in der öffentlichen Wahrnehmung
- Die zehn hĂ€ufigsten Sicherheitsrisiken bei Webanwendungen â OWASP Top 10 (u. a. SQLInjection, Cross-Site-Scripting, CSRF, Denial-of-Service)
- Interaktive Demonstrationen zu allen Risiken
- Aufzeigen der Auswirkungen
- Passende Beispiele mit realem Bezug
- Vorstellung von PrĂŒfwerkzeugen und Methoden bei der PrĂŒfung in Form von Penetrationstests
Notes:
- XSS bei eBay -> Haftung? Gesetzt sagt: Stand der Technik einhalten!
- OWASP SAMM/Cheat Sheet anschauen
- Pentest sicher/unsicher? Keine eindeutige Aussage, da Momentaufnahme!
- Security Beauftragter muss Fragen stellen um die Kommunikation anzuregen
- Entwickler tragen keine Verantwortung, wenn Sicherheitsaspekte nicht berĂŒcksichtigt werden
- Masche aus MaĂnahmen zur BekĂ€mpfung von Risiken schmĂ€hlern die Gefahr
- Verarbeitung von Kreditkartendaten gesetzl. jÀhrl. Pentest
- OWASP Ressourcen: Web security testing guide, OWASP-BWA - Test machine, ZAP, Juice-Shop
- Angriffe:
- Injection
- SQL, LDAP, OS-commands -> backend
- XSS -> frontend
- sqlmap /
Mc O'Caml
test
- Broken Authentication
- sessionId in GET
- nur sessionId als Authorisierung
- login brute-force verhindern
- Sesitive data sxposure
- backup files im www dir
- keine durchgĂ€ngige VerschlĂŒsslung
- XML External Entities (XXE)
- SOAP API
- Broken access control
- Zugriff auf Dateien
?page=/etc/passwd
- per ID auf Daten dritter zugreifen
- Zugriff auf Dateien
- Security misconfiguration
- HĂ€rtung der Infrastruktur
- update von 3rd party libs
- default accounts beachten
- XSS Cross-site-scriting
- js injection auf website
- Insecure deserialization
- parser libs updaten!
- Insufficient logging & monitoring
- fehlerhafte login Versuche
- Transaktionen protokollieren
- Injection
Eingabe im frontend & backend! validieren vor API Aufruf!
Trivia:
- Geheime Botschaften by Simon Singh (Buch)
- Mr. Robot (Serie)
- Hackers (Film)
- Iron Sky (Film)
<footer id="last-change">Last change: 2025-01-10, commit: <a href="https://github.com/dvogt23/notes/commit/5804de3">5804de3</a></footer>
Favorit songs:
- Grover Washington Jr - Just the Two of Us
- Lydie Auvray - Couscous
- Egor Kreed - ĐĄĐ°ĐŒĐ°Ń ŃĐ°ĐŒĐ°Ń
- Stephane Wrembel - Bistro Fada
- Adana Twins - Strange
- La Marina - Cuffinâ season (Remix) [feat. Fabolous]
- Harry Nilsson - One
- Bill Withers - Lean on Me
- NĂŽze - Marabout
- Coldplay - Hymn for the Weekend
- Frank Ocean - Pink Matter
- I Monster - Daydream In Blue
- Kid Cudi - Releaser
- Kid Cudi - Swim In The Light
- Kid Cudi - Frequency
- Rae Sremmurd - Black Beatles
- Petit Biscuit - Sunset Lover
- Jon Bellion - All Time Low
- Imagine Dragons - Believer
- Michael Kiwanuka - One More Night
- Michael Kiwanuka - Love & Hate
- Michael Kiwanuka - Cold Little Heart
- Jah Khalib - ĐąŃ ŃĐ»ĐŸĐČĐœĐŸ ŃĐ”Đ»Đ°Ń ĐČŃĐ”Đ»Đ”ĐœĐœĐ°Ń
- ĐŃĐžĐ±Ń - ĐąĐ°Đ”Ń Đ»ŃĐŽ
- Ulrich Tukur & Die Rhythmus Boys - Morphium
- Anitta - Vai malandra (feat. Tropkillaz & DJ Yuri Martins)
- Indila - DerniĂšre danse
- Yves Montand - Bella Ciao
- Manu Chao - Me Gustas Tu
- Manu Chao - Bongo Bong
- Pyotr Ilyich Tchaikovsky - The Seasons, Op. 37a: II. February. Carnival
- Lluni - King
- George Davidson - Mariage DâAmour
- Dendemann - Keine Parolen
- John Legend - Green Light (feat. André 3000)
- sean - Mercutio
- Deichkind - Richtig Gutes Zeug
- Evelyn Stein - Quiet Resource
- Zaz - Pourquoi tu joues faux
- Max Girko - ĐĐŽĐž ĐĐ° ĐŃĐŸŃĐŸĐč
- Zemlyane - The grass near the house
- Mark Eliyahu - Endless
- Old Man Canyon - Phantoms and Friends
- Estelle - American Boy
- Michael Kiwanuka - Solid Ground
- RIN - Monica Bellucci
- Eminem - Marsh
- MoTrip - Changed - Aus Sing meinen Song, Vol. 7
- Tima Belorusskih - ĐĐŽŃĐČĐ°ĐœŃĐžĐș
- Omega - Pegao / Me Miro y La Mire (TikTok Hit)
- Timati - ĐĐČĐ”Đ·ĐŽĐŸĐżĐ°ĐŽ
- Kanye West - Nah Nah Nah
- Shuggie Otis - Aht Uh Mi Hed
- ToĆĄe Proeski - Nesanica
- Ensemble Vanya - Russian Cyberfolk Song
- Zaz - Je veux
- Gorillaz - Feel Good Inc.
Books
Here is a list of books I read in the past, after school. My favorit genre are non-fiction books and biographies.
Read-list
- Die Rothschilds. Des Hauses Aufstieg, BlĂŒtezeit und Erbe
- The Luck of Barry Lyndon
- Das trunkene Schiff
- The Invisible Man
- Der Spieler
- Das Schneckenhaus by Mustafa Khalifa
2024
Trotzdem Ja zum Leben sagen: Ein Psychologe erlebt das Konzentrationslager by Viktor E. Frankl ISBN: 978-3328102779 â â â â â
Elon Musk by Walter Isaacson ISBN: 978-1982181284 â â â â
2023
Das Mittelalter: Europa von 500 bis 1500 by Chris Wickham ISBN: 978-3608962086 â â â
Monsieur Ibrahim und die Blumen des Koran by Eric-Emmanuel Schmitt ISBN: 978-3-25-060055-8 â â â
Das Neue Alphabet. Russische LesebĂŒcher. by Lew Tolstoi ISBN: - â â â
Der Prozess by Franz Kafka ISBN: 978-3-10-038190-3 â â â
2022
Imperium USA by Daniele Ganser ISBN: 978-3-946778-27-1 â â â â
US-Offiziere wie General Butler wissen, dass der US-Imperialismus in Lateinamerika rĂŒcksichtslos wĂŒtete. »Von 1909 bis 1912 war ich an der SĂ€uberung Nicaraguas fĂŒr das internationale Bankhaus Brown Brothers beteiligt«, erinnert sich Butler. »1916 habe ich den amerikanischen Zucker-baronen die Dominikanische Republik serviert. In China half ich, dafĂŒr zu sorgen, dass Standard Oil ungestört seinen GeschĂ€ften nachgehen konnte. In diesen Jahren hatte ich, wie die Jungs in den Hinterzimmern sagen wĂŒrden, eine prĂ€chtige Gangsterbande am Laufen. Wenn ich so zurĂŒckblicke, glaube ich, dass ich Al Capone ein paar Tipps hĂ€tte geben können. Er schaffte es gerade einmal, mit seiner Bande in drei Bezirken zu operieren. Ich operierte auf drei Kontinenten.«
Black Elk, der Medizinmann der Oglala Sioux, war ein Vertreter der Friedensbewegung und beschrieb diese Verbundenheit mit der Mensch-heitsfamilie so: »Der erste Friede - der wichtigste - ist der, welcher in die Seelen der Menschen einzieht, wenn sie ihre Verwandtschaft, ihre Harmonie mit dem Universum einsehen und wissen, dass im Mittelpunkt der Welt das groĂe Geheimnis wohnt, und dass diese Mitte tatsĂ€chlich ĂŒberall ist. Sie ist in jedem von uns - dies ist der wirkliche Friede, alle anderen sind lediglich Spiegelungen davon. Der zweite Friede ist der, welcher zwischen Einzelnen geschlossen wird, und der dritte ist der zwischen Völkern. Aber vor allem sollt ihr sehen, dass es nie Frieden zwischen Völkern geben kann, wenn nicht der erste Friede vorhanden ist, der, wie ich schon sagte, innerhalb der Menschenseele wohnt.«
Einzeln sein by RĂŒdiger Safranski ISBN: 978-3-446-25671-2 â â â â
Das ist die Pointe des Ganzen: Der Sinn von Sein ist die Zeit. Es gibt nichts Beharrendes. Wenn der Sinn von Sein die Zeit ist, so heiĂt das: Keine ĂŒbergreifende Idee, kein Gott, kein Ziel der Geschichte und so fort verbĂŒrgen diesen Sinn, wie das in der Tradition ĂŒblich ist. Es bleibt die Zeit, die zwar nicht aufhört, aber in der wir aufhören, weil wir befristet sind. Unsere Zeit ist die befristete, die tödliche Zeit.
Der Denkende ist zwar vereinzelt, aber nicht einsam, denn er bleibt in Gesellschaft - mit sich selbst. Denken, so Hannah Arendt, ist mit der Erfahrung des inneren GesprĂ€chs mit sich selbst verbunden: Das Denken ist, existentiell gesehen, etwas, das man allein tut, aber nicht einsam: allein sein heiĂt mit sich selbst umgehen; einsam sein heiĂt alleine sein, ohne sich in das Zwei-in-einem aufspalten zu können, ohne sich selbst Gesellschaft leisten zu können.
Dieser Vergleichszwang begĂŒnstigt zwar Wettbewerb und Konkurrenz und damit das Streben nach ĂŒberbietender OriginalitĂ€t, doch es entstehen eben auch neue AnpassungszwĂ€nge. Der Vergleichshorizont weitet sich, und es wird immer schwieriger, fĂŒr sich selbst MaĂstĂ€be und Orientierungen zu finden. In Anbetracht der vielen Möglichkeiten und Angebote ist das Eigene, was immer es bedeuten mag, in Ge-fahr, entwertet zu werden. Und so schlieĂt man sich eben einer Kohorte an und ĂŒbernimmt die dort maĂgeblichen Standards beim Lebens-stil, bei Meinungen und Uberzeugungen.
2020
21 Lektionen by Yuval Noah Harari ISBN: 978-3406739682 â â â â
-
Ein gutes Buch ĂŒber die aktuellen Gegebenheiten in der Welt. Und sehr viel pro westl. Politik ohne Reflektion.
Was also sollten wir unterrichten? Zahlreiche FachpĂ€dagogen behaupten, Schulen sollten sich auf die Vermittlung der vier Ks verlegen kritisches Denken, Kommunikation, Kollaboration und KreativitĂ€t. Allgemeiner sollten Schulen weniger Wert auf technisches Können legen und stattdessen universell anwendbare Lebensfertigkeiten in den Mittelpunkt rĂŒcken. Am allerwichtigsten wird die FĂ€higkeit sein, mit VerĂ€nderung umzugehen, neue Dinge zu lernen und in unvertrauten Situationen das seelische Gleichgewicht zu wahren. Wollen wir mit der Welt des Jahres 2050 Schritt halten, mĂŒssen wir nicht nur neue Ideen und Produkte erfinden wir mĂŒssen vor allem uns selbst immer wieder neu erfinden.â
Den Menschen wurde von frĂŒhester Kindheit an beigebracht, an die ErzĂ€hlung zu glauben. Sie hören sie von ihren Eltern, ihren Lehrern, ihren Nachbarn und der allgemeinen Kultur lange, bevor sie die geistige und emotionale UnabhĂ€ngigkeit entwickeln, die notwendig ist, um solche Geschichten zu hinterfragen und auf ihren Wahrheitsgehalt zu ĂŒberprĂŒfen. Zu der Zeit, da ihr Intellekt heranreift, sind sie so sehr in diese ErzĂ€hlung eingebunden, dass sie ihren Verstand eher dazu nutzen, sie rational zu begrĂŒnden als sie anzuzweifeln. Die meisten Menschen, die auf ldentitĂ€tssuche gehen, sind wie Kinder, die sich auf Schatzsuche begeben. Sie finden nur, was ihre Eltern zuvor fĂŒr sie versteckt haben.
Ein Gentleman in Moskau by Amor Towles ISBN: 978-3548290720 â â â â
- review
In guten wie in schlechten Tagen by Tayari Jones ISBN: 978-3716040256 âââ
- review
2019
Schlaf nicht wenn es dunkel wird by Joy Fielding
ISBN: 978-3-442-46173-8 âââ
- review
GesprÀch mit Freunden by Sally Rooney
ISBN: 978-3-630-87541-5 ââ
- review
The big five for life by John Strelecky
ISBN: 978-3423345286 âââ
- review
GRM - Brainfuck by Sibylle Berg
ISBN: 978-3462051438 âââââ
- review
Blechtrommel by GĂŒter Grass
ISBN: 978-3423118217 âââ
- review
Auf die BĂ€ume ihr Affen by Hans A. Pestalozzi
ISBN: 978-3729603134 âââââ
This book is the best retrospective view of the last few years in a political and social point of view. The author is so clear and straight forward in pointing to the causes of our all prblem situations in the current time of life.
JĂ€ger, Hirten, Kritiker by Richard David Precht
ISBN: 978-3442315017 âââ
A very good insight into the future problems and obstacles of todayâs society and possible solutions to counter them. Somewhat too superficial and predictable.
2018
Warum dĂ€nische Kinder glĂŒcklicher und ausgeglichener sind: Die Erziehungsgeheimnisse des glĂŒcklichsten Volks der Welt by Jessica Joelle Alexander (Autor), Iben Dissing Sandahl (Autor), Karin Wirth (Ăbersetzer) ISBN:978-3442393213 âââââ
- review
Just for fun (Linus Torvalds) by David Diamond
ISBN: 978-3423362993 ââââ
A really good book in an interview perspective. Linus Torvals tells how he was creating Linux with some nerdy details and how her workflow was/is in maintaining the best operating system in this world.
Neustart by Stephan Urbach
ISBN: 978-3426787298 ââââ
- review
Eine EinfĂŒhrung - EinflĂŒsse, Machtstrukturen und Selbstheilung im 21. Jahrhundert by Vinoth MĂŒller
ISBN: 978-3741877537 ââ
This book written by a âhobbyâ author who is burning for this topic and all that goes with it. It was really hard read it, cause it seems to be very unstructured and the inexperience of the author makes it difficult to read it as well.
The great Gatsby by F. Scott Fitzgerald
ISBN: 978-3150092422 âââ
Really good written old love story.
2017
Psychologie der Massen by Gustave Le Bon
ISBN: 978-3868200263 ââââ
Very good and concise book about the psychology of people who are influenced by the masses.
Ansichten eines Clowns by Heinrich Böll
ISBN: 978-3423004008 ââ
- review
Hundsköpfe by Morten Ramsland
ISBN: 978-3442736294 ââ
- review
Deutsch sein und schwarz dazu by Theodor Michael
ISBN: 978-3423348577 ââââ
A really good biogrophie of a african migrant at the beginning of the 19 century in germany and his experiences with racism in the epoch.
Elon Musk by Ashlee Vance & Elon Musk
ISBN: 978-3898799065 âââ
- review
1984 by George Orwell
ISBN: 978-3548225623 ââââ
- review
Past
Anna Karenina by Tolstoi
ISBN: 978-3491961968 ââââ
- review
Das glĂŒcklichste Volk - Sieben Jahre bei den PirahĂŁ-Indianern am Amazonas by Daniel Everett
ISBN: 978-3421043078 ââââ
- review
Das Tahiti Projekt by Dirk C. Fleck
ISBN: 978-3492253628 âââ
A futuristic utopia of a society in the future simulated on an island.
Kopf schlĂ€gt Kapital by GĂŒnter Faltin
ISBN: 978-3423347570 âââ
- review
Die Google Falle by Gerald Reischl
ISBN: 978-3800073238 âââ
Very superficial development history of google and the processes of a powerful software group.
GlĂŒck by Eckart von Hirschhausen
ISBN: 978-3499623554 ââ
- review
My list of interesting podcasts:
- Ungescriptet - Ben Berndt
- Was bisher geschah - Geschichtspodcast
- Alles Geschichte - History von radioWissen
- Jasmin Kosubek
- Alternativlos
- Betreutes FĂŒhlen
- Gemischtes Hack
- Darknet dairies
- Zeit Verbrechen
- SWR2 Wissen
- Daily Quarks
- Hotel Matze
- Fest & Flauschig
- The Joe Rogan experience
- Eine Stunde history
- 100 Sekunden Wissen
- Das Ziel ist im Weg
- GrenzgÀnger
History of podcast listening:
- Hazel & Thomas Gast: Usus Mango
- Elke Heidenreich eine gute Produzentin beim WDR
- Die Ernsthaftigkeit Deutschlands den Rassismus zu bekĂ€mpfen mit der AFD im Bundestag und einer #metoo Bewegung ohne einer Konsequenz fĂŒr jemanden
- Betreutes FĂŒhlen - Deine Chance im Stimmungstief
- eine Medizintablette Einnahme auf der rechte Seite liegend, erreicht 10x schneller das Ziel im Körper um zu Wirken.
- Betreutes FĂŒhlen - Machen Krisen stark?
- ertwarte nicht von jeder Krise ein Wachstum oder positiven Impact an dich selbst, da oft gesagt wird, wenn jemand erfolgreich ist, dass der jenige etwas schlimmes/traumatisches erlebt hat und daraus Kraft gezogen hat. Es reicht bewiesenermaĂen auch jemand der an dich glaubt und dich in deinem Vorhaben unterstĂŒtzt. Es muss zum Erfolg nicht etwas negatives wiederfahren sein⊠(eigene Zusammenfassung des Dialogs der beiden Hosts)
Series
Some of my favourite series:
Movies
Absolute favourite movies:
- Lucky number slevin
- Good will hunting
- Most of the âoldâ movies from Guy Ritchie
Videos
-
SWR Der mit dem Wald spricht - Peter Wohlleben Gast: Marc Marshall & Jana Palaske Video
Nur 3% der deutschen WĂ€lder sind im Ursprung echt, alles andere sind âPlantagenâ.
Der Baum ist im Wald nur der Zeiger einer Uhr, da die ganzen Tiere & Insekten meist ausgeblendet werden.
-
Youtube GrenzgĂ€nger - Shayan Garcia trifft AufspĂŒrerin Video
Die VergnĂŒgungsmaschine der kapitalistischen Kultur versucht jedes GefĂŒhl fĂŒr unsere Geschichte zu eliminieren. Damit die Gegenwart zu einer dauerhaften Wiederholung des hedonistischen Moments verkommt (nur auf das eigene GlĂŒck aussein) Das Gefangensein im immer Gleichen fördert nicht nur die Geschichtsvergessenheit, sondern auch die Ablehnung einer alternativen Zukunftsvision. Besonders junge Menschen sind heute im Kreislauf einer sofortigen Triebbefriedigung gefangen. Sie leben in einem Dauerrausch, es ist nicht nur die Sucht nach Sex und Drogen verbreitetet, sondern auch die Sucht nach Status und Erfolg. Die Sucht nach einer hohen Sichtbarkeit und Resonanz. In den kapitalistischen Zivilisationen ist gegen die Seelen der Jugendlichen ein Kampf zugange. Sie werden so dermassen abgestumpft, damit aus ihnen keine Wahrheitssucher und KĂ€mpfer fĂŒr Gerechtigkeit werden - Prof. Cornel West
Articles
- republik - Herr Drosten, woher kam dieses Virus?
-
MarderÂhunden und SchleichÂkatzen wird lebendig das Fell ĂŒber die Ohren gezogen. Die stossen TodesÂschreie aus und brĂŒllen, und dabei kommen Aerosole zustande. Dabei kann sich dann der Mensch mit dem Virus anstecken. Diese Tiere waren bei Sars-1 eindeutig die Quelle. Das ist wissenschaftlich belegt.
-
Das Kamel als religiöses Opfertier hat eine lange Tradition, eine sehr hohe Wertigkeit. Aber es kostet auch sehr viel Geld. Arme religiöse Menschen nehmen stattÂdessen Schafe. Aber je mehr Leute in jener Region reich wurden, umso mehr Kamele wurden geopfert. So werden heute beispielsÂweise zur Hadsch-Saison auf der Arabischen Halbinsel allein als Opfertiere jedes Jahr 40â000 Kamele geschlachtet. Das hat es vor fĂŒnfzig Jahren noch nicht einmal in AnsĂ€tzen gegeben. Letztlich, wo auch immer auf der Welt, geht es um die Modifikation von natĂŒrlichen Systemen: Eine grosse NutztierÂpopulation an irgendÂeinem Ort ist immer etwas KĂŒnstliches.
-
Alle, die sich nicht impfen lassen, werden sich mit Sars-2 infizieren. Der Begriff HerdenÂimmunitĂ€t stammt aus der VeterinĂ€rÂmedizin, wo man sich in frĂŒheren Jahren tatsĂ€chlich solche Ăberlegungen gemacht hat, zum Beispiel beim RinderpestÂvirus, dem MasernÂvirus der Rinder. HochĂŒbertragbar, aber durch eine Impfung lebenslang abzuhalten. Da kann man eben dann wirklich solche Rechnungen anstellen: Wir haben einen NutztierÂbestand, der ist in sich abgeschlossen â wie viele von den Tieren mĂŒssen wir jetzt impfen, damit das Virus nicht zirkulieren kann?
-
False balance? Dass man sagt: Okay, hier ist eine MehrheitsÂmeinung, die wird von hundert Wissenschaftlern vertreten. Aber dann gibt es da noch diese zwei Wissenschaftler, die eine gegenteilige These vertreten. In der medialen PrĂ€sentation aber stellt man dann einen von diesen hundert gegen einen von diesen zweien. Und dann sieht das so aus, als wĂ€re das 50:50, ein MeinungsÂkonflikt. Und dann passiert das, was eigentlich das Problem daran ist, nĂ€mlich dass die Politik sagt: «Na ja, dann wird die Wahrheit in der Mitte liegen.» Das ist dieser falsche Kompromiss in der Mitte.
-
Blogs
Here is a collection of my rss subscriptions:
- Lobsters - rss
- RealitÀtsabzweig - blog
- Zeitgeschehen im Fokus - blog
- heise Developer - Neueste Meldungen - rss
- netzpolitik.org - rss
- D. Kriesel - rss
- Fefes Blog - rss
- Graham Stevens â Grh.am - rss
- Hrvoje Ć imiÄ - rss
- Herman J. Radtke III Blog - rss
- Arkency - rss
- kevq.uk - rss
- huy.rocks - rss
- Julia Evans - rss
- Llogiq on stuff - rss
- Pro-Linux News - rss
- SupeRails blog - rss
- This Week In Neovim - rss
- Trends der Zukunft - rss
- Neil Kakkar - rss
- Google Scholar - Suche
- dblp
- Springer nature - open science
- Uni Trier
- Papers we Love
- 2 Minute Papers - Youtube
- SIG Conferences / Conference ranking
- Elicit
- SciSpace
Furniture
Livingroom
- Dinner table
- Turntable
- Plants
- Seats
Kitchen
- Esspresso machine rommelsbacher
- Espresso machine gaggia classic
- Breville
- Bezzera BZ10
- Waterfilter alb bestelemenst
- Calendar Saisonkalender
Office
- Wilkhan Rider chair/bumper
Interesting
- Design torquato
- Classics pamono
- Prints independentrepublic
- Furniture articture
- Vivense
- Homeloo
- postera.art
Wardrobe
Electro
Art
Roof
Indoor gardening
Outdoor
Clothing
Cooking
Pasta
For cooking pasta with the half of the energy, you could do it with the Dario Bressanini method. Just boil the water, turn off the stove and put the pasta into the pot for 12 minutes. It works cause pasta needs just 80°C for cooking.
Eggs
Prefer to eat 2-4 eggs a day, but take care of the yolk, dont boil or fry it. Just stir it underâŠ
Recipes
Bread
Sauerteig:
-
75 g Mehl (zum Beispiel Dinkel- oder Roggenmehl)
-
75 ml lauwarmes Wasser
-
2 groĂe EinmachglĂ€ser mit je mindestens 1,5 Liter (gibt es z.B. bei ** oder **Amazon), auf dem der Deckel locker aufsitzt und noch Luft durchlĂ€sst
-
einen Holzlöffel
-
Am ersten Tag gibst du 75 Gramm Mehl und 75 Milliliter lauwarmes Wasser in das Einmachglas und rĂŒhrst mit dem Holzlöffel gut um. Der Teig sollte, wie ein Waffelteig, leicht flĂŒssig sein.
-
Setze den Deckel (ohne Gummiring und ohne Klammern â der Sauerteig benötigt Luft) auf das Glas und stelle es an einen warmen Ort. Die optimale Temperatur fĂŒr die GĂ€rung betrĂ€gt zwischen 25 und 35 Grad Celsius.
-
Lasse den Teig fĂŒr zwölf Stunden ruhen und rĂŒhre ihn dann mit dem Holzlöffel erneut grĂŒndlich um. Lasse ihn danach wieder fĂŒr zwölf Stunden ruhen.
-
Gib vom zweiten bis zum vierten Tag tĂ€glich 75 Gramm Mehl und 75 Milliliter lauwarmes Wasser hinzu, rĂŒhre den Teig gut um und lasse ihn wieder 24 Stunden ruhen.
-
Am fĂŒnften Tag ist der Sauerteig fertig zum Weiterverarbeiten und du kannst nach dem folgenden Rezept Brot backen.
Brot:
-
400g Sauerteig
-
600g Mehl
-
250 bis 450ml lauwarmes Wasser (je nach Mehltyp, Vollkornmehl benötigt mehr Wasser als Auszugsmehl)
-
1 EL Salz
-
RĂŒhrschĂŒssel
-
Holzlöffel
-
deine HĂ€nde oder eine KĂŒchenmaschine
-
groĂe Backform (zum Beispiel bei **Memolife) oder Backblech fĂŒr den Laib
-
Butter oder Pflanzenöl zum Einfetten von Form/Blech
-
hitzebestÀndiges GefÀà mit Wasser (zum Beispiel eine Auflaufform)
-
Messer
-
Gib alle Zutaten in die SchĂŒssel und rĂŒhre krĂ€ftig um.
-
Wenn der Teig eine schön feste Konsistenz hat und nicht an deinen Fingern kleben bleibt, fange an, den Teig fĂŒr einige Minuten grĂŒndlich zu kneten. Mache dies entweder per Hand oder lasse deine KĂŒchenmaschine fĂŒr dich arbeiten.
-
Forme nach dem Kneten einen Laib aus dem Teig. Du kannst einen runden/ovalen Laib formen und auf das Backblech geben oder eine gefettete Backform nutzen.
-
Lasse den Brotrohling nun knapp eine Stunde im warmen Backofen bei 35 Grad Celsius gehen. Heize dafĂŒr den Backofen auf 50 Grad vor, stelle ihn wieder aus und gib den Rohling hinein. So geht der Sauerteig in der RestwĂ€rme ohne zu viel Energieaufwand.
-
Nimm nach einer Stunde den Rohling heraus, stelle den Ofen auf 175 Grad Umluft und gib die Auflaufform mit dem Wasser unten in den Backofen. Durch die Zugabe des Wassers wird das Brot nicht zu trocken und es bildet sich beim Backen eine schöne Kruste auf deinem Brot.
-
Schneide deinen Brotrohling nun an mehreren Stellen quer ĂŒber der OberflĂ€che ein.
-
Gib den Rohling in den heiĂen Backofen und backe ihn fĂŒr circa 45 Minuten.
Source: utopia
Pizza recipe
Basically you could use each pizza dough calculator on the internet. I actually prefer the oni app with 63% hydration for an home oven.
Neapolitan 6pcs:
24h:
- 1000g flour (caputo)
- 620ml water
- 3g dry east
- 30g salt
Neapolitan 10pcs:
Poolish (16-24h):
- 300ml water
- 5g dry yeast (fresh 10g)
- 5g honey
- 300g flour 00
Dough:
- 700ml water
- poolish (all)
- 40g sea salt
- 1250g flour
Neapolitan:
- 500g Mehl
- 350g Wasser (kalt)
- 15g Salz
- 0.5g Hefe
16h bei Zimmertemperatur, 270g groĂe Teiglinge, dann 6h Zimmertemperatur
Mehl und Wasser kurz verrĂŒhren und 20-30 Minuten abgedeckt stehen lassen. AnschlieĂend Hefe und Salz zugeben und mit dem Knethaken der KĂŒchenmaschine 5-8 Minuten auf langsamer Stufe, dann 8-10 Minuten auf zweiter Stufe zu einem elastischen Teig auskneten. Der Teig ist ausgeknetet, wenn er sich ohne zu reiĂen in die LĂ€nge ziehen lĂ€sst (Fenstertest). Den Teig fĂŒr 18-48 Stunden luftdicht verschlossen im KĂŒhlschrank reifen lassen. Je lĂ€nger er reift, desto aromatischer und groĂpori- ger wird am Ende die Pizza. Den Teig aus dem KĂŒhlschrank neh- men, in vier gleich schwere StĂŒcke teilen. Zu Kugeln formen, gut abdecken oder verschlieĂen und etwa 4 Stunden bei Raumtempe- ratur gehen lassen, bis sich das Volumen deutlich vergröĂert hat. Mindestens 30 Minuten vor dem Backen: Den Backofen mit Kera- mikbackstein auf 275 °C Ober-/Unterhitze vorheizen. Tomaten, Salz und Olivenöl mit den HĂ€nden zu einer stĂŒckigen SoĂe zerdrĂŒ- cken. Basilikum waschen, trockenschĂŒtteln, etwa 2/3 der BlĂ€tt- chen grob zerrupfen und untermengen.
Egg salad
- 10 Eier
- 250 gr. Mayo
- 1 Tl Senf
- 5 gr. Zucker
- 1 Tl. Salz
- Prise Pfeffer
- Schnittlauch nach Bedarf
Pancakes
FĂR DEN TEIG (15 Stk.)
- 375 g Weizenmehl (Type 405)
- 3 - 4œ EL Zucker
- 3 TL Backpulver
- 1œ Prisen Salz
- 3 Eier (Gr. M)
- 300 ml Milch
Coffee
I love to drin k good coffee, especially from an espresso machine. Have my own for a few months and been happy to learn doing great extractions.
Good coffee brands:
- Hausbrandt (Venecia)
- Julius Meinl
- Cofymi
Garden
Basic
- Some basic garden Indoor gardening
Teracce
- Roofing TUI Maximaal
Trees
- Artmeyer Gartenbaumschule regional tree selling shop
Garage
Electro connection
âElektroinstallation auf 10 A Dauerlast prĂŒfen in der Garage ist ohnehin eine gute Idee, weil StromanschlĂŒsse in Garagen gern gepfuscht werden.â - Source
Pharmacy
Our home pharmacy list should always be available:
- AntimĂŒckenspray
- Autan
- Erbrechen
- Vomex
- ErkÀltung
- Grippostad
- Halsschmerzen
- Dobendan Strepsis Synergie Honig & Zitrone
- Husten
- Mucosolvan
- Kopfschmerzen
- Paracetamol
- Krampf
- Buscopan
- Magen-Darm
- Iberogast
- MandelentzĂŒndung
- Tantum Verde Spray
- Tonsipret Tabletten
- Nasenspray
- Nasic+
- Orthomol
- Immun
- Schmerz-/Fieber
- Ibuprofen 400
- Stiche
- Fenistil
- Wunde
- Bepanthen
Kids:
- BlÀhungen
- Lefax Pumpliquid
- Durchfall
- Elektrolyte Elotrans
- Elektrolyte OralpÀdon 240 Erdbeere
- Loperamid
- Fieber
- Paracetamol ZĂ€pfchen
- Nurofen Saft
- Ohrentropfen
- Otalgan
- Schmerz
- Voltaren
- Schnupfen
- Kochsalzlösung 0,9% Ampullen
- Nasivin fĂŒr Babys (Kochsalz nicht hilft)
- Verstopfung
- Babylax oder Glycilax ZĂ€pfchen
- Movicol
- Zahnbeschwerden
- Dentinox Gel
Homestead
The most important point for building or buy your own house is to have the garden in south direction.
Doorbell
Self-made
If you want to try to do it yourself:
Kanalization
Kids
Lifehacks
Elternschaft ist schon eine lustige Sache. Du versuchst etwas zu tun, von dem niemand jemals wusste, wie man es richtig macht. Aber du willst dein Bestes geben! Also was kannst du am besten tun? Das Erste ist, ein wenig an sich selbst zu arbeiten. Verbringe genĂŒgend Zeit mit dir selbst. Schau dich genau an: Wie du bist, wie du sitzt, wie du stehst, wie du sprichst, was du machst, was du nicht machst. Ich denke, man muss sich selbst sehr genau betrachten. Denn die Kinder erfassen alles schnell und sie werden das, was du tust, verstĂ€rken. Eines der wichtigsten Dinge ist, sich zumindest so zu gestalten, wie man sein möchte. Jemand ist damit vielleicht nicht einverstanden. Das ist egal! Zumindest hast du versucht so zu sein, wie du dich magst. Das ist das Mindeste, was du tun kannst. Vielleicht erfĂŒllst du die Erwartungen anderer nicht. Wir wissen nicht, was andere fĂŒr Wertvorstellungen haben. Aber wenigstens musst du so werden, wie du dich magst. - Sadhguru
Media
- Ernest & Celestine Great french series for kids (kika.de german)
- Marco polo great series about adventures and personalities of inventors
- Bluey Great calm series for kids
Learning
I love to learn something newâŠ
Sources:
- Some new speaking languages duolingo
- Quick short syntax check learnxinminutes
- Keyboard typing Keybr
- TypingClub typingclub
- Shortcuts shortcutfoo
- TypeRacer typeracer
Coding
Doing different coding challenges:
Some of my solutions: Github/CodeChallanges
Speaking languages
- learn german as russian learngerman.dw.com
- japanese tofugu
Spaced repetition
Writing good prompts forces one to circle around a concept, look at it from multiple angles, probe its properties, link it to other concepts through similarities and differences, reason about consequences and significance, derive parts of it from more fundamental pieces, and come up with a few concrete examples of it. These are the things that really build understanding.
Source: two-wrongs
Cycling
Cool bikes
Cargo bikes
Hiking
Munsterland
Basketball
I love playing basketball and doing it in a local team twice a week. Here are some notes about my favorite sport.
Defense
A good article about defense position and play moves.
Health
Vitamins
- https://www.lavita.com Great juice for the daily vitamin balance
- Vitamin D should be taken orally as an oil and in combination with calcium and vitamin K2.
ePA
- besser der Nutzung widersprechen, nach der Aussage von Herr Lauterbach bei der Digital Health Conference des Bitkom heise
- die Zugriffe auf diese Daten wird bis 2030 nicht protokolliert mdr
Drug dealer vs. doctor
If your doctor prescribes you medication without first asking about âŠ
- your diet
- your sleep
- your exercise routine
- your water consumption
- whether you have any structural issues
- the stress in your life Then you donât have a doctor, you have a drug dealer.
Best summary of good food practice
-
Die ganze Farbpalette GemĂŒse, Salate, KrĂ€uter und FrĂŒchte sind wertvolle Lieferanten fĂŒr MikronĂ€hrstoffe und sekundĂ€re Pflanzenstoffe, wovon Ihr Stoffwechsel, Immunsystem und Energielevel profitieren. Essen Sie so bunt wie möglich: Die Farben von GemĂŒse und Obst stehen fĂŒr verschiedene NĂ€hrstoffe und wertvolle sekundĂ€re Pflanzenstoffe. Stellen Sie sich einen bunten Mix zusammen, um von deren Gesundheitsvorteilen zu profitieren. Wenn Sie zu saisonalen Sorten greifen, essen Sie automatisch abwechslungsreich.
-
Kurze Wege Lebensmittel aus der Region liefern Ihnen mehr Vitamine und sekundĂ€re Pflanzenstoffe als gespritzte GewĂ€chshausware aus dem SĂŒden â und sie sind besser fĂŒr die Umwelt. Es gibt viele Arten, sich gesund zu ernĂ€hren. Dass es dabei vorrangig auf die QualitĂ€t der Lebensmittel ankommt, beweisen die Ă€ltesten Menschen der Welt, die sich hauptsĂ€chlich von unverarbeiteten Lebensmitteln ernĂ€hren, die in ihrer Region wachsen und gedeihen. Der Weg zum Bauern in der NĂ€he lohnt sich: Alte Obstsorten aus der Region sind oft vertrĂ€glicher fĂŒr Allergiker. Gerade bei tierischen Produkten kommt es auf QualitĂ€t und Herkunft an. Je besser die Tiere ernĂ€hrt und gehalten werden, desto mehr gesunde NĂ€hrstoffe stecken in Fleisch, Eiern und Milchprodukten.
-
Ăberwiegend pflanzlich Hochwertige, pflanzliche Lebensmittel wie GemĂŒse, Obst, KrĂ€uter, NĂŒsse und heimische Vollkorngetreide liefern uns viele NĂ€hrstoffe pro Kalorie. Forschungsergebnisse zeigen, dass eine gute Versorgung mit MikronĂ€hrstoffen ein entscheidender Faktor bei der PrĂ€vention ist.1,2 Pflanzliche Lebensmittel sind zudem unsere einzige Quelle fĂŒr darmgesunde Ballaststoffe. Es reicht, wenn Sie den Fokus Ihrer ErnĂ€hrung auf pflanzliche Lebensmittel legen. Sie mĂŒssen sich nicht ausschlieĂlich pflanzlich ernĂ€hren, um gesund zu essen.
-
Dem Darm eine Pause gönnen Unser Darm beeinflusst unsere Gesundheit in vielen Bereichen. Er beeinflusst, wie gut wir NĂ€hrstoffe aufnehmen, er ist Teil unseres Immunsystems und er ist auch ein wichtiger Hormonproduzent. Mit einer vorwiegend pflanzlichen, ballaststoffreichen ErnĂ€hrung halten Sie das Mikrobiom und Ihren Darm gesund. Um sich zu regenerieren, benötigt unser Darm Pausen. Empfehlenswert sind dreistĂŒndige Esspausen zwischen den Mahlzeiten, aber auch Intervallfasten oder Fasten allgemein unterstĂŒtzt die Regeneration des Darms. Die 100-JĂ€hrigen in Japan essen nach dem Prinzip âHara hachi buâ. Dahinter verbirgt sich die darmgesunde Regel, nur so viel zu essen, bis der Magen zu 80 Prozent gefĂŒllt ist. Lassen Sie Lebensmittel weg, die Sie schlecht vertragen.
-
Ganze Lebensmittel Ein ganzes Dinkelkorn löst in unserem Körper eine völlig andere Reaktion aus als ein helles WeiĂmehlbrötchen. Auch eine frische Beere wirkt anders als das gezuckerte ErdbeerpĂŒree im Fruchtjoghurt, ein StĂŒck Fleisch anders als eine Scheibe Mortadella und frisches Olivenöl anders als gehĂ€rtete Industriefette. Je naturbelassener unsere Lebensmittel sind, umso wertvoller und nĂ€hrstoffreicher sind sie fĂŒr uns. Egal welche ErnĂ€hrungsform Sie bevorzugen: Die Menge an ganzen, unverarbeiteten Lebensmitteln ist ein gutes MaĂ, um verschiedene ErnĂ€hrungsweisen zu beurteilen.
-
TĂ€glich LaVita als Basis LaVita unterstĂŒtzt uns tĂ€glich mit allen wichtigen Vitaminen und Spurenelementen, gerade dann, wenn unsere ErnĂ€hrung nicht immer optimal ist oder ein erhöhter Bedarf durch Stress oder Medikamente besteht. Viele ErnĂ€hrungsexperten wie Prof. Walter Willett von der Harvard University raten im Hinblick auf unsere ErnĂ€hrungsgewohnheiten zusĂ€tzlich zu einer tĂ€glichen MikronĂ€hrstoffergĂ€nzung.
-
Trinken bevor der Durst kommt Der Mensch besteht zu 80 Prozent aus Wasser. Nichts ist wichtiger fĂŒr uns. Wasser ist ein entscheidendes Transportmittel, das NĂ€hrstoffe zu unseren Zellen transportiert. Moderate Mengen Kaffee oder koffeinhaltigen Tee können Sie zur FlĂŒssigkeitszufuhr dazuzĂ€hlen. Viele machen sich um Ihre Wasserzufuhr wenig Gedanken. Mit wie viel Wasser am Tag fĂŒhlen Sie sich wohl? 1,5 bis 2 Liter pro Tag sind ein guter Richtwert.
Source: LaVita Newsletter Jun 2024
Daily goals for a healthy feeling
Gesunde ErnĂ€hrung im Alltag â Top-Tipps
- Starten Sie mit drei festen Mahlzeiten pro Tag â mit Pausen von jeweils 4 Stunden.
- Essen Sie zu einer Mahlzeit Obst (z. B. FrĂŒhstĂŒck) und zu den anderen beiden Mahlzeiten GemĂŒse.
- Freunden Sie sich mit HĂŒlsenfrĂŒchten an: Essen Sie mehrmals pro Woche eine Handvoll.
- TĂ€glich eine Handvoll NĂŒsse â im MĂŒsli, im Salat oder als Topping.
- Optimieren Sie Ihre MikronÀhrstoffzufuhr, wenn Sie es nicht immer schaffen, ausgewogen zu essen oder wenn Sie durch Belastungen oder Medikamenteneinnahme einen erhöhten Bedarf haben.
Psychisch
- FĂŒhren Sie eine Morgenroutine ein: Diese Zeit am Morgen gilt allein Ihren Interessen und BedĂŒrfnissen.
- Tragen Sie Ihre Hobbys fest in den Terminkalender mit ein.
- Belohnen Sie sich fĂŒr gemeisterte, schwierige Aufgaben und gönnen Sie sich aktiv Pausen.
- Fördern Sie positive soziale Kontakte: Verbringen Sie wöchentlich Zeit mit Personen, die Ihnen Energie schenken und Sie inspirieren.
- Achten Sie auch hier auf eine gesunde ErnĂ€hrung und gute MikronĂ€hrstoffzufuhr: Biotin, Jod, Kupfer, Magnesium, Vitamin C und viele B-Vitamine tragen zu einer normalen Funktion des Nervensystems bei und die B-Vitamine unterstĂŒtzen auch die normale psychische Funktion.
Source: LaVita Newsletter Jun 2024
Recommendation for healthy heart
Lebensmittel | Menge | Sorten | Zu Vermeiden |
---|---|---|---|
Obst | 3â5 Portionen pro Tag | Alle zuckerarmen Obstsorten wie Beeren, Clementinen, Grapefruit, Kiwi, Nektarine | Gezuckerte Obstkonserven und Obstmus, kandierte FrĂŒchte |
Nur in MaĂen zuckerreiche Sorten: Ananas, Banane, Birne, Honigmelone, Mango | |||
GemĂŒse | Mind. 4 Portionen pro Tag | Fast alle GemĂŒsesorten, insb. Feldsalat, GrĂŒnkohl, Knoblauch, Spinat, Rote Bete | Mais, GemĂŒsekonserven (salzreich) |
HĂŒlsenfrĂŒchte | Mehrmals pro Woche, mind. 300 Gramm | Alle Sorten, egal ob getrocknet, aus der Dose oder TiefkĂŒhlware | Gezuckerte HĂŒlsenfrĂŒchte |
Brot, Getreide & Beilagen | 4 Portionen pro Tag | Vollkornbrot und -brötchen, Haferflocken, MĂŒsli ohne Zucker, Vollkornnudeln | WeiĂ- und Toastbrot, Zwieback, Weizenbrötchen, Pommes |
NĂŒsse & Samen | 30â40 g pro Tag | Naturbelassene Mandeln, WalnĂŒsse, CashewnĂŒsse, KĂŒrbiskerne, Lein- und Chia-Samen | Gesalzene NĂŒsse, gebrannte Mandeln |
Fette & Ăle | 2 EL pro Tag | Olivenöl, Rapsöl, Walnussöl, Hanföl, Leinöl | Schweine- und GĂ€nseschmalz, Palmfett, Sonnenblumenöl |
Fisch & MeeresfrĂŒchte | 2 Portionen pro Woche | Fisch (frisch oder TK); insbesondere wie Lachs, Makrele, Hering | Fisch in Mayonnaise oder Sahne eingelegt |
Eier | Mehrmals pro Woche | ||
Milch & Milchprodukte | 250 g pro Tag | Milch (1,5 % Fett), Buttermilch, Speisequark, Naturjoghurt, Kefir | Mayonnaise, Sahne, Schmand, gesĂŒĂte Fertigprodukte |
KĂ€se | 2 Scheiben (50â60 g) pro Tag | KĂ€se bis 45 % Fett i. Tr.: Harzer KĂ€se, körniger FrischkĂ€se, SchnittkĂ€se | |
Fleisch & Wurstwaren | Max. 1â2 kleine Portionen pro Woche | Mageres Fleisch wie Putenbrust, HĂŒhnerfleisch | Rotes Fleisch, Schweinefleisch, alle Wurstwaren |
Snacks & SĂŒĂigkeiten | Selten, maximal 1 kleine Handvoll pro Tag | Mind. 70%ige Zartbitterschokolade, Obst, Haferkekse | SĂŒĂigkeiten, sĂŒĂe Backwaren, sĂŒĂe Milchprodukte, Chips |
GetrĂ€nke | 1,5â2 Liter pro Tag | Wasser, ungezuckerter KrĂ€utertee | MilchmixgetrĂ€nke, Alkohol, Fruchtsaft, Softdrinks |
Source: LaVita Newsletter August 2024
Documents
I prefer to scan my entire post incoming via iphone Readdle - Scanner Pro to my cloud and organize my personal document collection in following structure:
-
Arbeit und Beruf Zeugnisse, Studienunterlagen, Diplome, Arbeits- und AusbildungsvertrĂ€ge, FortbildungsmaĂnahmen, ArbeitsvertrĂ€ge, Lohn- und Gehaltsabrechnungen, Beurteilungen
-
Fahrzeuge Fahrzeugpapiere, Unterlagen Kfz-Steuer, Rechnungen Reparatur, Belege zu UnfĂ€llen, Mitgliedschaften Automobilclub, TĂV- und ASU-Belege
-
Finanzen und Steuern SteuererklĂ€rungen, Steuerbescheide, Kontoeröffnungen, KontoauszĂŒge, FreistellungsauftrĂ€ge, Vermögenswirksame Leistungen, KreditvertrĂ€ge, Aktien, Geldanlagen
-
Gesundheit Krankenversicherung, Schreiben Krankenkasse, Impf- oder Mutterpass, Auslandskrankenversicherung, Pflegeversicherung, Rechnungen zu Behandlungen, Ărztliche Gutachten
-
Persönliche Dokumente Heirats- und Geburtsurkunden, Familienstammbuch, Reisepass, MeldebestĂ€tigungen, Lebenslauf, Testament, PatientenverfĂŒgung, Vorsorgevollmacht, Meldungen zur Sozialversicherung
-
Versicherungen VersicherungsvertrÀge jeder Art, VersicherungsnachtrÀge, Unterlagen zur privaten und gesetzlichen Rentenversicherung
-
Wohnen oder Immobilien MietvertrĂ€ge, Belege fĂŒr Kaution, Nebenkostenabrechnungen, VertrĂ€ge mit VersorgungstrĂ€gern (Strom, Gas, Wasser) und Telefonanbietern, RundfunkbeitrĂ€ge, Kaufbelege Wohnungseinrichtung und ElektrogerĂ€te, Notarielle VertrĂ€ge und Urkunden zum Eigenheim bzw. zur Eigentumswohnung, Grundbuchauszug, Rechnungen zu Reparaturen und Modernisierung
-
Kinder FĂŒr jedes Kind wird ein Ordner mit folgenden Dokumenten angelegt: Geburtsurkunde, Impfausweis, Zeugnisse, Ausbildungsnachweise, Hobby, Mitgliedschaften in Vereinen
-
Hobby, Freizeit und Sport VertrĂ€ge zu Mitgliedschaften im Fitnessstudios oder Vereinen, Kaufbelege fĂŒr SportgerĂ€te oder âAusrĂŒstung
Script for create folder structure in terminal...
mkdir -p "Arbeit und Beruf/Zeugnisse"
mkdir -p "Arbeit und Beruf/Studienunterlagen"
mkdir -p "Arbeit und Beruf/Diplome"
mkdir -p "Arbeit und Beruf/Arbeits- und AusbildungsvertrÀge"
mkdir -p "Arbeit und Beruf/FortbildungsmaĂnahmen"
mkdir -p "Arbeit und Beruf/ArbeitsvertrÀge"
mkdir -p "Arbeit und Beruf/Lohn- und Gehaltsabrechnungen"
mkdir -p "Arbeit und Beruf/Beurteilungen"
mkdir -p "Fahrzeuge/Fahrzeugpapiere"
mkdir -p "Fahrzeuge/Unterlagen Kfz-Steuer"
mkdir -p "Fahrzeuge/Rechnungen Reparatur"
mkdir -p "Fahrzeuge/Belege zu UnfÀllen"
mkdir -p "Fahrzeuge/Mitgliedschaften Automobilclub"
mkdir -p "Fahrzeuge/TĂV- und ASU-Belege"
mkdir -p "Finanzen und Steuern/SteuererklÀrungen"
mkdir -p "Finanzen und Steuern/Steuerbescheide"
mkdir -p "Finanzen und Steuern/Kontoeröffnungen"
mkdir -p "Finanzen und Steuern/KontoauszĂŒge"
mkdir -p "Finanzen und Steuern/FreistellungsauftrÀge"
mkdir -p "Finanzen und Steuern/Vermögenswirksame Leistungen"
mkdir -p "Finanzen und Steuern/KreditvertrÀge"
mkdir -p "Finanzen und Steuern/Aktien"
mkdir -p "Finanzen und Steuern/Geldanlagen"
mkdir -p "Gesundheit/Krankenversicherung"
mkdir -p "Gesundheit/Schreiben Krankenkasse"
mkdir -p "Gesundheit/Impf- oder Mutterpass"
mkdir -p "Gesundheit/Auslandskrankenversicherung"
mkdir -p "Gesundheit/Pflegeversicherung"
mkdir -p "Gesundheit/Rechnungen zu Behandlungen"
mkdir -p "Gesundheit/Ărztliche Gutachten"
mkdir -p "Persönliche Dokumente/Heirats- und Geburtsurkunden"
mkdir -p "Persönliche Dokumente/Familienstammbuch"
mkdir -p "Persönliche Dokumente/Reisepass"
mkdir -p "Persönliche Dokumente/MeldebestÀtigungen"
mkdir -p "Persönliche Dokumente/Lebenslauf"
mkdir -p "Persönliche Dokumente/Testament"
mkdir -p "Persönliche Dokumente/PatientenverfĂŒgung"
mkdir -p "Persönliche Dokumente/Vorsorgevollmacht"
mkdir -p "Persönliche Dokumente/Meldungen zur Sozialversicherung"
mkdir -p "Versicherungen/VersicherungsvertrÀge"
mkdir -p "Versicherungen/VersicherungsnachtrÀge"
mkdir -p "Versicherungen/Unterlagen Rentenversicherung"
mkdir -p "Wohnen oder Immobilien/MietvertrÀge"
mkdir -p "Wohnen oder Immobilien/Belege fĂŒr Kaution"
mkdir -p "Wohnen oder Immobilien/Nebenkostenabrechnungen"
mkdir -p "Wohnen oder Immobilien/VertrÀge mit VersorgungstrÀgern und Telefonanbietern"
mkdir -p "Wohnen oder Immobilien/RundfunkbeitrÀge"
mkdir -p "Wohnen oder Immobilien/Kaufbelege Wohnungseinrichtung und ElektrogerÀte"
mkdir -p "Wohnen oder Immobilien/Notarielle VertrÀge und Urkunden"
mkdir -p "Wohnen oder Immobilien/Grundbuchauszug"
mkdir -p "Wohnen oder Immobilien/Rechnungen"
mkdir -p "Kinder/Geburtsurkunde"
mkdir -p "Kinder/Impfausweis"
mkdir -p "Kinder/Zeugnisse"
mkdir -p "Kinder/Ausbildungsnachweise"
mkdir -p "Kinder/Hobby"
mkdir -p "Kinder/Vereine"
mkdir -p "Hobby, Freizeit und Sport/VertrÀge"
mkdir -p "Hobby, Freizeit und Sport/Kaufbelege"
Source: sos-buerodienste
Misc
@misc
Avatar
Avatar maker
https://getavataaars.com/?accessoriesType=Blank&clotheColor=Gray01&clotheType=ShirtCrewNeck&eyeType=Default&eyebrowType=Default&facialHairColor=BrownDark&facialHairType=BeardLight&hairColor=BrownDark&mouthType=Serious&skinColor=Brown&topType=ShortHairShortFlat