Skip to content

Instantly share code, notes, and snippets.

@fjctp
fjctp / Dockerfile
Last active November 29, 2017 05:14
Simple Nodejs Server
FROM node:alpine
COPY server.js /
EXPOSE 80
ENTRYPOINT ["node", "/server.js"]
@fjctp
fjctp / install.sh
Created February 20, 2018 03:04
pychromecast
# install pychromecast
pip install pychromecast
# get a patch for YOUTUBE CONTROLLER to work
wget -O PYTHON_DIR/LIB/site-packages/pychromecast/pychromecast/controllers/youtube.py \
https://github.com/ur1katz/pychromecast/raw/master/pychromecast/controllers/youtube.py
@fjctp
fjctp / asyncio-forever-loop.py
Created April 1, 2018 21:38
asyncio and subprocess
#!/usr/bin/env python
import asyncio
import logging
async def periodic_worker(loop):
wait_sec = 1.0
while True:
t0 = loop.time()
await asyncio.sleep(wait_sec)
@fjctp
fjctp / subprocess-video-conversion.py
Created April 1, 2018 21:40
transcode with python subprocess
#!/usr/bin/python3
import os.path
from time import ctime
from multiprocessing import Pool
from subprocess import call
# Define variables
HOME = "/home/pi/workplace"
BIN = os.path.join(HOME, "bin")
PY = os.path.join(HOME, "py")
@fjctp
fjctp / README.md
Last active October 29, 2018 02:48
Run RancherOS in Hyper-V
@fjctp
fjctp / README.md
Last active February 20, 2019 04:37
Build ROS 2 crystal for raspberry pi
@fjctp
fjctp / docker-compose.yaml
Last active September 23, 2019 23:48
docker volume nfs4
volumes:
example_vol:
driver_opts:
type: "nfs4"
o: "addr=SERVER_IP,nolock,hard,rw"
device: ":/path/to/dir"
@fjctp
fjctp / README.md
Last active March 14, 2020 22:41
Loop device in Linux

Loop Devices

Loop devices are how entire file systems can be mounted. If you have had any experience with most virtualization (eg KVM, Virtualbox, VMware, etc) the most common way Guests store data is in a file (aka virtual disk) which can contain an entire operating system or more on a specified file system. The "virtual disk" file with its contents is mounted for use by the Guest and generally protected from other access.

In the same way, it might be useful to mount an ISO file for access without burning the file's contents to an optical disk (CD or DVD typically).

There are other scenarios where it's useful to mount file systems so that they are accessible from the currently running system.

The file containing the file system that attached to a loop device is typically called a backing file.

@fjctp
fjctp / README.md
Last active July 6, 2024 09:38
RPi Zero W kiosk

Summary

Setup RPi Zero W as a kiosk

Step

  1. write Raspbian Lite image to a SD card
  2. enable ssh
touch /boot/ssh
  1. setup WiFi
@fjctp
fjctp / ubuntu-server-20.04-sense-hat.md
Last active November 1, 2020 16:44
Using sense hat in Ubuntu Sever 20.04
  1. Ensures that the Industial I/O Core module is not loaded.

The modules blacklisted here takes over the pressure and magnetic sensors of the Sense HAT device which prevents other applications from using those sensors.

Create the file /etc/modprobe.d/blacklist-industialio.conf with the following contents:

blacklist st_magn_spi
blacklist st_pressure_spi
blacklist st_sensors_spi