Skip to content

Instantly share code, notes, and snippets.

View paul-ridgway's full-sized avatar

Paul Ridgway paul-ridgway

View GitHub Profile
'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
@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
@paul-ridgway
paul-ridgway / email.rb
Created February 9, 2023 10:50
Send a test email from the Rails console
ActionMailer::Base.mail(from: "[email protected]", to: '[email protected]', subject: 'test', body: "Test").deliver
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",
#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
rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/usr/tmp/*","/run/*","/mnt/*","/media/*","/var/cache/*","/","/lost+found"} /* /path/to/some/backup/folder
@paul-ridgway
paul-ridgway / web-response-times.sh
Created December 13, 2024 08:21
"Ping" a website and measure the response times
#!/bin/bash
# Adapted from https://gist.githubusercontent.com/weeyin83/c697468c5986cb3385990fa1c4c2d72b/raw/b8eed6a3259122bce442f2db5c9030f982948a88/websiteresponse.sh
if [ -z "$1" ]; then
echo "Usage: $0 <URL>"
exit 1
fi
last_run=0;
while true; do