Skip to content

Instantly share code, notes, and snippets.

@lucabelluccini
lucabelluccini / rpi4.boot-from-sd-rootfs-on-usb.md
Last active October 13, 2023 12:38
Raspberry Pi 4 - Boot from SD, Rootfs on USB

Raspberry 4B - Boot from SD and rootfs on USB

Update

RPi4 now supports booting directly from USB. First update to get an eeprom which supports USB Boot, then configure the bootloader to boot from USB.

Original guide

  1. Download Raspbian from the official site
@hboylan
hboylan / lambda-s3-read-write-by-line.js
Last active January 6, 2023 18:38
AWS Lambda function to read and write S3 files by line to perform efficient processing
const stream = require('stream')
const readline = require('readline')
const AWS = require('aws-sdk')
const S3 = new AWS.S3()
// read S3 file by line
function createReadline(Bucket, Key) {
// s3 read stream
const input = S3

PDF Make Definitions

A list of all the properties for the Document Definition objects in PDF Make. Gathered from the examples source code. Up to date for version 0.1.38.

Basic definition

  • The Document Definition is a javascript object: {}. It can contain the following.
  • content: array. This defines the layout of your document. All your tags will be defined in there. You define tags using object (e.g. content: [{text: 'Hello World'}])
  • styles: object. A dictionary of all the named styles in your document. You can then apply a style to any object using style: 'name' or style: ['name1', 'name2']
  • defaultStyle: object. Defines a style to be applied to every element in the document.
  • images: object. Another dictionary that you can use to specify all the images in your document.
@vshymanskyy
vshymanskyy / M5Stack_Espruino.js
Last active February 6, 2024 19:53
M5Stack Espruino initialization example
/*
Also, need to change in ILI9341pal.js:
var LCD_WIDTH = 320;
var LCD_HEIGHT = 240;
*/
BTN1 = D39
BTN2 = D38
BTN3 = D37
SPKR = D25
@milesjordan
milesjordan / vpc.yaml
Last active April 4, 2024 02:37
Cloudformation template for a VPC with ipv6, with public and private subnets, calculating the subnet ipv6 CIDR blocks on the fly.
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Public VPC and subnets
Resources:
#
# Public VPC
#
PublicVpc:
@alexellis
alexellis / k8s-pi.md
Last active April 11, 2024 14:17
K8s on Raspbian
@ccnokes
ccnokes / axios-instance-config.js
Created July 6, 2017 16:23
Good default configuration for axios in node.js
const axios = require('axios');
const http = require('http');
const https = require('https');
module.exports = axios.create({
//60 sec timeout
timeout: 60000,
//keepAlive pools and reuses TCP connections, so it's faster
httpAgent: new http.Agent({ keepAlive: true }),
@bjpirt
bjpirt / face.py
Last active February 10, 2017 17:43
A quick demo of doing face tracking on the MeArm Pi so that you can make the arm follow you
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
from mearm import MeArm
width = 640
arm = MeArm()
arm.base.moveTo(0)
@alexellis
alexellis / pwd-faas.md
Last active January 19, 2017 15:49
pwd-faas-quickstart.md

FaaS - functions as a Service Quick Start / Test Drive

This page has moved into the repository!

Head over the to Github repository for the TestDrive document

@joepie91
joepie91 / express-server-side-rendering.md
Last active February 20, 2024 20:52
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti