Code

Ruby on Rails

https://github.com/Bratela/openbsd Install Ruby Install Ruby and set Symlinks doas su - pkg_add ruby-3.1.2 ln -sf /usr/local/bin/ruby31 /usr/local/bin/ruby ln -sf /usr/local/bin/bundle31 /usr/local/bin/bundle ln -sf /usr/local/bin/bundler31 /usr/local/bin/bundler ln -sf /usr/local/bin/erb31 /usr/local/bin/erb ln -sf /usr/local/bin/gem31 /usr/local/bin/gem ln -sf /usr/local/bin/irb31 /usr/local/bin/irb ln -sf /usr/local/bin/rdoc31 /usr/local/bin/racc ln -sf /usr/local/bin/rake31 /usr/local/bin/rake ln -sf /usr/local/bin/rdoc31 /usr/local/bin/rbs ln -sf /usr/local/bin/rdoc31 /usr/local/bin/rdbg ln -sf /usr/local/bin/rdoc31 /usr/local/bin/rdoc ln -sf /usr/local/bin/ri31 /usr/local/bin/ri ln -sf /usr/local/bin/typeprof31 /usr/local/bin/typeprof Install Nokogiri pkg_add ruby31-nokogiri-1.13.1p0 Install Rails pkg_add ruby-3.

Git Tags

With Tags, we have the possibility to “Tag” a certain Point as important. Just give it a release Number (v0.1, v0.2, v1.0) or whatever you like. list tags list all tags for a certain repo git tag add Tag when you’re fine with a version, add a tag … git tag -a v1.0 -m "my Version 1.0" push Tags you have to push the Tags separatly. they do not get pushed with the common “git push” command

Go CrossCompile

Crosscompile under GoLang Python is cool and everybody like it, but i also like the Concept of writing some Code, compile it for different Platforms and run it everywhere. Google’s Go Language got the possiblity to compile it for multiple Architectures and Operating Systems at the same time. Why not give a try … ? Little Hello World package main import ( "fmt" "os" ) func main() { s := "world" if len(os.

VSCode

settings.json Useful Settings for VSCode … settings.json test -d .vscode || mkdir .vscode cat << EOF > .vscode/settings.json { "python.linting.enabled": true, "python.linting.pylintEnabled": true, "python.formatting.provider": "black", "python.formatting.blackArgs": [ "--line-length=100" ], "python.sortImports.args": [ "--profile", "black" ], "editor.formatOnSave": false, "[python]": { "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.organizeImports": true }, }, } EOF launch.json cat << EOF > .vscode/launch.json { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes.

Little Mail Validator in Python

wrote a little Mail Adresse Validator in Python. use it, modify it, like it … best practice for python is to use a virtual env like Poetry (or virtualenv) and add the “email-validator” module like this: poetry add email-validator Code few lines of code … #!/usr/bin/env python3 from email_validator import validate_email, EmailNotValidError ok=[] nok=[] emails = [ "my+address@mydomain.tld", "hans@dampf.ch", "gott@welt.net", "adsf@asdf.com", "asf.asdf", "franz!mueller@abc.com", "asdf@asdf.adf" ] print ("\nMy Little Mail Validator\n") for email in emails: try: # Validate.

C

some stuff i learned about the “C” Language -> https://www.c-howto.de/tutorial/einfuehrung/ DataTypes Char to Store one single Character #include<stdio.h> int main() { char zeichen1; char zeichen2; zeichen1 = 'A'; zeichen2 = 66; printf("Zeichen: %c, %c\n", zeichen1, zeichen2 ); return 0; } Zeichen: A, B Short / unsigned short #include<stdio.h> int main() { // kleine Zahl mit Vorzeichen deklarieren (erstellen) short kleineZahl; // kleine Zahl auf Grenzwert setzen kleineZahl = 32767; // kleineZahl ausgeben printf("Wert von kleineZahl: %d\n", kleineZahl); // eins hochzählen, also 32767+1, was eigentlich 32768 ergibt kleineZahl++; // kleineZahl ausgeben printf("Wert von kleineZahl: %d\n", kleineZahl); return 0; } Wert von kleineZahl: 32767 Wert von kleineZahl: -32768 int 16 or 32 Bit, depending on Architectur

Regex IPv4 & IPv6

Regex is cool. But have you ever tried to grep IPv4 / IPv6 Adresses from a File or extract from a bunch of data ? Did you use Google Search and found lot of Links, Tip’s and Examples ? And non of them worked well ? I can highly recommend CyberChef for stuff like that … https://gchq.github.io/CyberChef/ Regex from CyberChef If you wanna use Regex in your own Scripts, here is a little Extract from Cyberchef.

Poetry

Intro Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. Links https://python-poetry.org/ https://www.infoworld.com/article/3527850/how-to-manage-python-projects-with-poetry.html Install OpenBSD … and update path pip install --user poetry cat <<'EOF'>> ~/.profile # Poetry export PATH=$PATH:~/.local/bin EOF . ~/.profile ev install as root ? doas pip install --user poetry cat <<'EOF'>> ~/.profile # Poetry export PATH=$PATH:/root/.

Puffy Spezial

Tips, Trick, Notes and Snippets around OpenBSD tty0 to fb0 on ARM you may need to redirect tty0 on arm64 boxes cat << EOF > /etc/boot.conf set tty fb0 EOF Switch Keyboard Language -> to Swiss German wsconsctl keyboard.encoding=sg Disable Root Password Login usermod -p'*' root find Package for a certain Binary # pkg_info -E /usr/local/bin/gwc /usr/local/bin/gwc: coreutils-9.0 coreutils-9.0 file, shell and text manipulation utilities Show Content of a Package # pkg_info -L coreutils Information for inst:coreutils-9.