Blog

sha256: 2b87a252a3d912530dd8c20df6bee7f6cbc4ede0074fdf217e318aab39d9736c

GIT add Folder to Repo

wanna switch a local folder to a remote git repo ?

https://docs.github.com/en/github/using-git/adding-a-remote

GitoLite

create git repo with gitolite (myproject)

add Folder

cd myproject

git init
git remote add origin git@your-git-server:myproject

check Status

git remote -v
git status

add all existing Files, commit and push to remote

git add .
git commit -m "initial commit"
git push --set-upstream origin master

Any Comments ?

sha256: ba5ff311face100add7e9b21efbbb86af94545d3aec2cf8d920ea55ba5353464

Cheatsheet

IP Commands from @linuxopsys

Curl from @linuxopsys

NMAP from @hackingarticles

5 Years Later, Is Docker Still Delivering ?

Beginner Python CheatSheet NoStarch

Docker CLI Cheat Sheet

Docker Command Cheat Sheet

Visual Studio Code for macOS

Linux Netzplan CT

Ansible Edureka

Windows Events

NMAP

SQL Stuff

Bash Convention and Libraries

Assembler 80186 and higher

HTTP Status Codes

Python Cheatsheet - Olivier La Flamme

Data Wrangling with pandas Cheat Sheet

OWASP Key Management Cheat Sheet

Adafruit Feather Huzzah ESP8266

Got a new Toy …

Datasheet esp8266

https://cdn-learn.adafruit.com/downloads/pdf/adafruit-feather-huzzah-esp8266.pdf

Pinout

https://cdn-learn.adafruit.com/assets/assets/000/046/249/original/adafruit_products_Huzzah_ESP8266_Pinout_v1.2-1.png?1504885873

Manual Adafruit NeoPixel Überguide

https://www.play-zone.ch/de/fileuploader/download/download/?d=1&file=custom%2Fupload%2FFile-1459843180.pdf

Driver

https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

Wire Diagram

https://learn.adafruit.com/feather-weather-lamp/circuit-diagram

ESP8266 Arduino Core’s documentation

https://arduino-esp8266.readthedocs.io/en/latest/

ESP8266WiFi library

https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/readme.html

Playing with LED


gpio.mode(3, gpio.OUTPUT)

gpio.write(3, gpio.LOW)

gpio.write(3, gpio.HIGH)

Blinking Stuff


while 1 do

  gpio.write(3, gpio.HIGH)

  tmr.delay(1000000)  -- wait 1'000'000 us = 1 Second

  gpio.write(3, gpio.LOW)

  tmr.delay(1000000)  -- wait 1'000'000 us = 1 Second

end

More blinking


-- Pin definition

local pin = 3

local status = gpio.LOW

local duration = 1000 -- 1 second duration for timer

-- Initialising pin

gpio.mode(pin, gpio.OUTPUT)

gpio.write(pin, status)

-- Create an interval

tmr.alarm(0, duration, 1, function ()

  if status == gpio.LOW then

    status = gpio.HIGH

  else

    status = gpio.LOW

  end

  gpio.write(pin, status)

end)

Get SSID’s


wifi.setmode(wifi.STATION)

-- print ap list

function listap(t)

  for k,v in pairs(t) do

    print(k.." : "..v)

  end

end

wifi.sta.getap(listap)

More SSID

wifi.setmode(wifi.STATION)

-- print ap list

function listap(t)

  for ssid,v in pairs(t) do

    authmode, rssi, bssid, channel = string.match(v, "(%d),(-?%d+),(%x%x:%x%x:%x%x:%x%x:%x%x:%x%x), (%d+)")

    print(ssid,authmode,rssi,bssid,channel)

  end

end

wifi.sta.getap(listap)

Connect to Wlan

wifi.sta.config("SSID","PASSWORT")

wifi.sta.connect()

tmr.delay(1000000) -- wait 1,000,000 us = 1 second

print(wifi.sta.status())

print(wifi.sta.getip())

Arduino & IDE

https://learn.adafruit.com/adafruit-io-basics-esp8266-arduino/using-arduino-ide

Borg

Exclude Dir

CAT << 'EOF' > CACHEDIR.TAG
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by Borg.
# For information about cache directory tags, see:
#       http://www.bford.info/cachedir/spec.html
EOF
chmod 444 CACHEDIR.TAG

Any Comments ?

sha256: 182ef42d357dcaa9a5150e6bc4c617dee1fa0dcbb3ee0382c95e94fac7910265

Debian on APU4

debian on apu

boot

menu -> tab

-> debian-installer/i386/linux vga=788 initrd=debian-installer/i386/initrd.gz — console=ttyS0,115200

enter

space

:)

english

country switzerland

nic0

hostname apu005

domain planet

mirror ch -> ftp.ch.debian.org

root password

Partitioning: entire Disk & LVM

Separate /home /var /tmp

survey no

soft: standard system utilities & ssh server

grub yes

braucht ca. 30min !

automated

https://www.debian.org/releases/stable/amd64/apbs02.en.html https://www.debian.org/releases/buster/example-preseed.txt

Packages

apt-get -y install net-tools git htop

Reboot

geht 40 Sekunden

Any Comments ?

sha256: de990ff6c33196dbecc6d133f0fc29686ded54fa7357d30e7dc36a59f0368eb0

OpenBSD & PHP Stuff 7.4

Install NGINX & PHP

pkg_add nginx php--%7.4
rcctl enable nginx php74_fpm

Edit php.ini

sed -i s'/date.timezone = UTC.*/date.timezone = Europe\/Zurich/'  /etc/php-7.4.ini
sed -i s'/short_open_tag = Off.*/short_open_tag = On/'  /etc/php-7.4.ini

Stop 7.3 & Start 7.4

rcctl stop php73_fpm
rcctl restart nginx php74_fpm

Uninstall PHP 7.3

pkg_del php--%7.3
pkg_del -a

Any Comments ?

sha256: 850d0140d76843ff867fcf764ff3313d19cf8d967c611e180b6a264e7bc274c4

Hamster Rad

Projekt Hamster Counter

Hamsterrad

Reed Sensor

Installation

Ziel

Ein kleiner Hamster Rad Zähler, um etwas über das (nächtliche) Laufverhalten des Nagers zu erfahren.

Website

Das Projekt hat nen kleinen Webserver bekommen mit Live Statistiken Webserver nur IPv6 erreichbar

Hardware

Aufbau

das Supermaget klebst Du auf das Hamsterrad auf die Rückseite. Das Rad so gut wie es geht am Gehäuse befestigen. Der Magnetsensor steckst/klebst Du ans Gehäuse und kuckst, dass ca. 1 cm Abstand hast zum Magneten am Rad. Die zwei Kabel am Magneten schraubst/lötest du an die 10m Litze und gehst damit auf den Serial Stecker. Dort schliesst Du die Drähte am Pin 4 und Pin 6 an. Das Script gibt logisch “1” auf den DTR Pin und wenn das Magnet schliesst, dann hast Du Logisch “1” auf DSR. DSR wird dann im Script ausgelesen und gezählt

Bigdata

How to Process Large Files … ?

Large is a variable Term, 700 GB is large for me, while it could be a small peace for others.

Assuming you need to count the lines … this simple Task can take minutes !

Size

[user@host /tmp]$ du -sh bigfile
745G bigfile

Wordcount -> 10 min

if you need to count the lines, use the wordcount command and you get the exact number … but you have to wait for minutes, depending in your disk subsystem and the file size of course

Crontab

Troubleshooting Crontab Problems

Dump the Environment

add this line to root’s crontab

* * * * * env > /root/cronenv

Load the Environment

env - $(cat /root/cronenv) /bin/sh

Run your script

./script_with_env_problems.sh

and check it’s output …


Any Comments ?

sha256: de1667fb4003135420244f48280d72e03d7559b675ab6b4a9c020b0725866525

ipv4 & ipv6

What’s my Public IP[4|6] Address from Cli ?

We all know the Situation when we’re working on some Maschines, locally or through ssh and asking ourself what ip address we get when reach out the internet.

My Dude “m2m” was so kind to wrote a litte Service years ago.

IP Inno CH - just try it out

and you get the anwer, for ipv4 and ipv6 on one page. With IP, PTR, SAS and other information. Without AD, Tracking Cookies and all the other Shit.