Skip to content

Instantly share code, notes, and snippets.

View tosiara's full-sized avatar

tosiara

View GitHub Profile
@tosiara
tosiara / patch.md
Created December 29, 2021 12:14
Patch for sshd: Authentication refused: bad ownership or modes for directory /data

You may not connect to sshd on LineageOS because of wrong /data permissions:

sshd: Authentication refused: bad ownership or modes for directory /data
  1. Navigate to your LineageOS 14.1 source dir
  2. Open file external/openssh/misc.c
  3. Find function safe_path and comment out this code block:
@tosiara
tosiara / icalendar.py
Created January 2, 2023 11:04
Parse ical Google Calendar export
from icalendar import Calendar, Event
g = open("sun.ics","rb")
gcal = Calendar.from_ical(g.read())
for component in gcal.walk():
if component.name == "VEVENT":
print(component.get('summary'), component.get('dtstart').dt)
g.close()
@tosiara
tosiara / tensorflow.md
Last active April 5, 2023 07:00
Build tensorflow without cpu optimizations
apt-get update
apt install apt-transport-https curl gnupg patchelf -y
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
mv bazel-archive-keyring.gpg /usr/share/keyrings
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list

apt-get update
apt-get install bazel=5.3.0
@tosiara
tosiara / 99-nordvpn.sh
Created December 13, 2023 11:41
conditional routing of guest network
#!/bin/sh
table=nordvpn
wifi=wlan1-2
wifi_if=nordvpn
wg=wg0
if [ "$INTERFACE" == "$wg" ]; then
if [ "$ACTION" == "ifup" ]; then
logger "NORDVPN: $INTERFACE $ACTION"
@tosiara
tosiara / extract-face-make-collage.sh
Created December 15, 2024 19:49
Exctract faces and make collage out of them
i=0
for file in *.jpg; do
echo "$i $file"
name=$(basename "$file")
facedetect "$file" | while read x y w h; do
convert "$file" -crop ${w}x${h}+${x}+${y} -resize 640x640 "face_${i}.${name##*.}"
i=$((i+1))
done
i=$((i+1))
done