Skip to content

Instantly share code, notes, and snippets.

View poulou0's full-sized avatar
🍋

Poulou poulou0

🍋
View GitHub Profile
@poulou0
poulou0 / zhann.zsh-theme
Last active August 3, 2020 13:47
zsh zhann theme with k8s context info
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git svn
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
#!/bin/bash
# A sample script for raspberry pi with 3.5 lcd, by poulou
normal=$(cat << EOF
██████████ ██████████
██████ ████ ████ ██████
██████ ████ ████ ██████
██████ ████ ████ ██████
████████ ██████ ██████ ████████
@poulou0
poulou0 / octoprint_cheat_sheet.md
Last active June 26, 2023 14:25
Octoprint (octopi) cheat sheet

Setup openvpn with .ovpn file

pi@octopi:~ $ sudo apt install openvpn
pi@octopi:~ $ sudo mv 11.pi3-octoprint.ovpn /etc/openvpn/11.pi3-octoprint.conf
pi@octopi:~ $ sudo systemctl restart openvpn

Setup wireguard with .conf file

pi@octopi:~ $ sudo apt install wireguard
pi@octopi:~ $ sudo mv pi3_OCTOPI.conf /etc/wireguard/wg0.conf
@poulou0
poulou0 / panolens_example.htm
Last active October 20, 2021 07:33
Panolens example
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
html, body {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
}
@poulou0
poulou0 / raspi-cheat-sheet.md
Last active October 21, 2022 13:34
raspi4 cheat sheet

To ssh without password

ssh-copy-id pi@192.168.x.x

Restart if offline

Append a job to crontab https://stackoverflow.com/a/16068840/1748645

(crontab -l; echo "*/5 * * * * /bin/bash -c \"ping -c 1 8.8.8.8 &> /dev/null || sudo reboot\"") | crontab
@poulou0
poulou0 / Xorg-headless-raspberry-pi.md
Last active March 3, 2023 12:45
Run x server (xorg xinit) on a headless raspberry pi in DISPLAY=:0

Install the minimum

sudo apt update && \
sudo apt install xvfb x11vnc xinit tightvncserver && \

We start Xorg server through Xvfb

printf "[Unit]\nDescription=xvfb custom\nAfter=multi-user.target\nStartLimitIntervalSec=0\n\n[Service]\nType=simple\nRestart=always\nRestartSec=1\nUser=pi\nExecStart=/usr/bin/xinit -- /usr/bin/Xvfb :0 -screen 0 1360x768x24\n\n[Install]\nWantedBy=multi-user.target\n" | sudo tee /etc/systemd/system/xvfb.service && \
sudo systemctl enable xvfb.service && sudo systemctl start xvfb.service \

We need to put something in the .initrc

Example

sudo apt install openbox tint2 firefox && printf "firefox -width 1360 -height 768 &\ntint2 &\nopenbox" > ~/.xinitrc

@poulou0
poulou0 / linux-cheatsheet.md
Last active April 23, 2023 14:15
linux cheatsheet
  • nmap

    If installed with snap it gives an error: dnet: Failed to open device enp0sxxxx

    Fix: https://askubuntu.com/a/1312647

    scan network
    sudo nmap -sT -O 192.168.1.0/24 > nmap_output
    
  • kernel install

    https://github.com/linux-surface/linux-surface/wiki/Installation-and-Setup
    
  • Firefox touchscreen scroll

    https://superuser.com/a/1485044
    
  • Pop!_OS bluetooth not working after installing linux-surface/linux-surface

@poulou0
poulou0 / JavascriptClient.html
Last active July 11, 2022 07:11
Dead simple PHP Websocket with Ratchet
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
var conn = new WebSocket('ws://localhost:8080/chat?apiToken=blahblah');
conn.onmessage = function(e) { console.log(e.data); };
conn.onopen = function(e) { conn.send('Hello Me!'); };
</script>
@poulou0
poulou0 / README.md
Last active September 23, 2022 07:18
mjpg-streamer notes

mjpg-streamer

Install

sudo apt-get install cmake libjpeg62-turbo-dev gcc g++ && \
cd ~ && \
git clone https://github.com/jacksonliam/mjpg-streamer && \
cd mjpg-streamer/mjpg-streamer-experimental/ && \
make && sudo make install && \
printf '[Unit]\nDescription=Start mjpeg-streamer on startup.\nAfter=multi-user.target\n\n[Service]\nType=simple\nExecStart=/usr/local/bin/mjpg_streamer -o "output_http.so -w ./www" -i "input_uvc.so"\nExecStop=/usr/bin/killall mjpg_streamer\n\n[Install]\nWantedBy=multi-user.target\n' | sudo tee /etc/systemd/system/mjpeg-streamer.service && \
sudo systemctl enable mjpeg-streamer.service && sudo systemctl start mjpeg-streamer.service