Skip to content

Instantly share code, notes, and snippets.

View paul-ridgway's full-sized avatar

Paul Ridgway paul-ridgway

View GitHub Profile
rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/usr/tmp/*","/run/*","/mnt/*","/media/*","/var/cache/*","/","/lost+found"} /* /path/to/some/backup/folder
#include <string>
#include <Arduino.h>
#define IR_RECEIVE_PIN 10
#if !defined(RAW_BUFFER_LENGTH)
#if RAMEND <= 0x4FF || RAMSIZE < 0x4FF
#define RAW_BUFFER_LENGTH 200 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
#elif RAMEND <= 0x8FF || RAMSIZE < 0x8FF
#define RAW_BUFFER_LENGTH 600 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
#else
import axios from "axios";
import axiosRetry from "axios-retry";
import { statusById } from "./wallbox/chargerStatuses";
class Wallbox {
private _token?: string;
private _client = axios.create({
baseURL: "https://api.wall-box.com",
@paul-ridgway
paul-ridgway / email.rb
Created February 9, 2023 10:50
Send a test email from the Rails console
ActionMailer::Base.mail(from: "no-reply@factfind.app", to: 'test-tjdh9e9f6@srv1.mail-tester.com', subject: 'test', body: "Test").deliver
@paul-ridgway
paul-ridgway / create-db-and-user-mysql.sql
Created August 23, 2022 06:59
Create a database and user with full access.
CREATE DATABASE database;
CREATE USER 'username'@'%' IDENTIFIED WITH authentication_plugin BY 'password';
# Or
CREATE USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON database.* TO 'username'@'%';
FLUSH PRIVILEGES
'use strict';
/*
* Complete the 'strokesRequired' function below.
*
* The function is expected to return an INTEGER.
* The function accepts STRING_ARRAY picture as parameter.
*/
function strokesRequired(picture) {
// Write your code here
function strokesRequired(picture) {
var strokes = 0;
while (true) {
// Find the next truthy cell and extract x and y
const next = picture.flatMap((row, x) => row.flatMap((char, y) => (char && { char, x, y }))).filter(r => r)[0];
if (!next) { // None left means the picture is filled
break;
}
const remove = [[next.x, next.y]]; // We will remove the current cell after
eliminateNeighbours(picture, [], remove, next.char, next.x, next.y);
name: Build
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
core_a: ["STM32"]
core_b: ["stm32"]
board: ["Nucleo_144"]
opts: ["pnum=NUCLEO_F767ZI,upload_method=MassStorage,xserial=generic,usb=none,xusb=FS,opt=osstd,rtlib=nano"]
rsync -aAXv --progress --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/usr/tmp/*","/run/*","/mnt/*","/media/*","/var/cache/*","/","/lost+found","/backup"} /* /backup/
Mongoid.default_client.collections.each(&:drop)