Skip to content

Instantly share code, notes, and snippets.

View Tony763's full-sized avatar

Antonín Skala Tony763

View GitHub Profile
@projectgus
projectgus / gist:6757491
Created September 29, 2013 23:29
Arduino sketch to calculate CRC32 of a given file from the SD card
/*
* SD card CRC32 calculator by Angus Gratton for Freetronics
*
* CRC32 implementation based on the implementation in the C SNIPPETS archive
* http://web.archive.org/web/20080303102524/http://c.snippets.org/snip_lister.php?fname=crc_32.c
*
* Original Copyright (C) 1986 Gary S. Brown. You may use this program, or
* code or tables extracted from it, as desired without restriction.
*
* This version is released with the same lack of restrictions, use however you please.
@trendels
trendels / rsync_daemon_over_ssh.md
Last active July 25, 2024 20:42
Rsync daemon mode over ssh

rsync daemon mode over ssh

There are several common ways to do rsync backups of hosts over ssh:

  1. As a non-root user. Upsides: very secure. Downside: cannot back up sensitive files.
  2. As root, with a public key. Downsides: Whoever has the private key has full root access to the host being backed up.
  3. As root, with a public key and a "forced command". Upsides: Restricts access to the server. Downsides: Requires either careful matching of rsync options (which might change over time), or "validator" scripts. Neither idea sounds very appealing to me.
  4. Running rsync in daemon mode on the host being backed up. Upsides: Lots of useful options, like read-only mode, running as a different user if required, server-side excludes/includes, etc. Downsides: Opens up a TCP port that has full filesystem read access and is hard to secure (Ideally you could make the rsync daemon use a unix socket instead, that could be secured by filesystem permissions, but I haven't found a way to do that).

Here is another option t

@numberoverzero
numberoverzero / async_value.py
Created July 6, 2015 02:50
Variable that can be `await`ed on to reach a certain value, without blocking an event loop
import asyncio
missing = object()
class Value:
'''
Simple class that enables `await value.wait_for(foo)` to wait until the
variable is set to the expected value, without blocking the event loop.
Loosely modeled after asyncio.Event and asyncio.Condition
@r00tdaemon
r00tdaemon / Install PyQt5 on Ubuntu with python3 .md
Last active May 4, 2024 04:08
Install PyQt5 on Ubuntu with python3. Steps to set up PyQt5 (ubuntu). With python code generation

Installation

pip3 install --user pyqt5  
sudo apt-get install python3-pyqt5  
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools

Configuring to run from terminal