Skip to content

Instantly share code, notes, and snippets.

View lemanschik's full-sized avatar
🚀
Founder of Germany's Only Hybrid Cloud Provider

Frank Lemanschik lemanschik

🚀
Founder of Germany's Only Hybrid Cloud Provider
View GitHub Profile
@lemanschik
lemanschik / WireGuard_Setup.txt
Created December 29, 2023 17:03 — forked from chrisswanda/WireGuard_Setup.txt
Stupid simple setting up WireGuard - Server and multiple peers
Install WireGuard via whatever package manager you use. For me, I use apt.
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
MacOS
$ brew install wireguard-tools
Generate key your key pairs. The key pairs are just that, key pairs. They can be
@lemanschik
lemanschik / HowToOTGFast.md
Created December 3, 2023 10:04 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@lemanschik
lemanschik / HowToOTG.md
Created December 3, 2023 06:05 — forked from gbaman/HowToOTG.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@lemanschik
lemanschik / install-chrome-stable-linux.md
Last active October 29, 2023 10:39
install google-chrome-stable linux

Translated via mistral from https://aur.archlinux.org/packages/google-chrome current snapshort as tar.gz PKGBUILD File done by frank+github@lemanschik.com note: shasum got not translated correct got shortned. fixed by hand

// Maintainer: Christian Heusel <christian@heusel.eu>
// Contributor: Knut Ahlers <knut at ahlers dot me>
// Contributor: Det <nimetonmaili g-mail>
// Contributors: t3ddy, Lex Rivera aka x-demon, ruario, Abdullah

// Check for new Linux releases in: http://googlechromereleases.blogspot.com/search/label/Stable%20updates
// or use: $ curl -sSf https://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages | grep -A1 "Package: google-chrome-stable" | awk '/Version/{print $2}' | cut -d '-' -f1
@lemanschik
lemanschik / btrfs-guide.md
Created October 14, 2023 06:52 — forked from MaxXor/btrfs-guide.md
Btrfs guide to set up an LUKS-encrypted btrfs raid volume with included maintenance & recovery guide

Encrypted Btrfs storage setup and maintenance guide

Initial setup with LUKS/dm-crypt

This exemplary initial setup uses two devices /dev/sdb and /dev/sdc but can be applied to any amount of devices by following the steps with additional devices.

Create keyfile:

dd bs=64 count=1 if=/dev/urandom of=/etc/cryptkey iflag=fullblock
chmod 600 /etc/cryptkey
@lemanschik
lemanschik / understand-https-sessions.md
Created October 2, 2023 03:17
Understand http sessions

A Requests gets issued by a browser normaly a HTTP conform client will accept set cookie headers and apply that cookies on the next request

if you need more fine grained controle eg multi session it is clever to attach the cookie content as server query parameters via url?param=xxxx&param=2

the first method logs out via deleting the cookie or replacing it the secund via deletion of browser cache.

to prevent man in the middle you could implement something like a one time factor. something that is only valid once and in a given period.

@lemanschik
lemanschik / ecmascript-array-methods.md
Last active September 30, 2023 05:56
ecmascript-array-methods

zipArrays the art of merging two or more arrays of identical length pair wise.

const zip = (arr, ...arrs) => 
  arr.map((val, i) => 
  arrs.reduce((a, arr) => [...a, arr[i]], [val]));

examples:

const a = [1, 2, 3];
const b = [4, 5, 6];
@lemanschik
lemanschik / Anti Patterns Packaging.md
Last active March 15, 2023 04:44
Anti Patterns Packaging

Anti Patterns Packaging

anti: Referencing assets inside js files to integrate them

export {default as icon} from './src/styles/logo-blue-32x32.png';
import './src/styles/logo-blue.scss';

correct: Referencing them as string inside your app later central in your build tool or deploy chain resolve the asset references if needed most best is to even optain the asset references from a central file or api depending on the app size. As Rule never process your assets when you process your development code.

@lemanschik
lemanschik / Create a Array of Length and fill it.md
Last active March 11, 2023 06:50
Create a Array of Length and fill it

Examples

Array.from({length: 10},(_v, i) => {});
Array(10).forEach((_v, j) => {});
Object.assign(Array(),{ length: 10 });
Object.assign([],{ length: 10 });

const myArray = [1,2,3,5]
myArray.length = 0; // Ultra fast clear array