Skip to content

Instantly share code, notes, and snippets.

@leandrofilipe
leandrofilipe / Raspberry Pi RAID NAS Server Setup.md
Last active March 31, 2024 23:26
Raspberry Pi RAID NAS Server Setup

※ Raspberry Pi RAID NAS Server Setup ※

Hardware:

  • Raspberry Pi 4 (4GB RAM)
  • Micro SD card 32GB
  • 2x Integral USB 3.1 flash drives 128GB

OS:

  • Raspbian Buster
@ma8ma
ma8ma / gtknotebookdnd.py
Created August 4, 2018 21:04
Notebook Tab Drag and Drop Example (GTK+3 & Python3)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Notebook Tab Drag and Drop Example (GTK+3 & Python3)
#
# Requirements:
# * Python (>=3.5)
# https://www.python.org/
#
# * GTK+ (>=3.0)
@htruong
htruong / chroot-to-pi.sh
Last active May 10, 2024 16:54
Chroot to pi sd card
#!/bin/bash
# This script allows you to chroot ("work on")
# the raspbian sd card as if it's the raspberry pi
# on your Ubuntu desktop/laptop
# just much faster and more convenient
# credits: https://gist.github.com/jkullick/9b02c2061fbdf4a6c4e8a78f1312a689
# make sure you have issued
@Atinux
Atinux / async-foreach.js
Last active October 10, 2023 03:04
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
import gi
import time
from gi.repository import GObject, Gst
gi.require_version('Gst', '1.0')
Gst.init(None)
pipeline = Gst.Pipeline()
rpicamsrc = Gst.ElementFactory.make("rpicamsrc", "rpicam")
h264parse = Gst.ElementFactory.make("h264parse", "h264")
flvmux = Gst.ElementFactory.make("flvmux", "flv")
@mrvanbakel
mrvanbakel / nokia-lcd-animation.ino
Created August 12, 2016 14:27
Particle Photon - Nokia 5110 LCD bitmap animation
//AIM logo animation by MrvanBakel
// include the libary to communicate with the LCD
#include "nokia-5110-lcd/nokia-5110-lcd.h"
//bitmap movie frames, frame 1 is the default logo
char AIM1[504] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@Lewiscowles1986
Lewiscowles1986 / rPi3-ap-setup.sh
Last active July 16, 2023 15:33
Raspberry Pi 3 access-point-setup
#!/bin/bash
#
# This version uses September 2017 august stretch image, please use this image
#
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
@robatron
robatron / javascript-log-wrapping.md
Last active February 6, 2024 06:49
Wrapping `console.log` (et al.) in your own function to modify logging behavior.

JavaScript Log Wrapping

Wrapping console.log (et al.) in your own function to modify logging behavior.

Why?

You may want a simple way to:

@pazdera
pazdera / gist:1098129
Created July 21, 2011 20:29
Singleton example in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of Singleton design pattern
# Copyright (C) 2011 Radek Pazdera
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.