Skip to content

Instantly share code, notes, and snippets.

View jptrsn's full-sized avatar

Edu_Coder jptrsn

View GitHub Profile
@jptrsn
jptrsn / sw_button_bt_home.js
Last active January 19, 2024 22:42
espruino swbutton
// Add the following module URL to the "communications" section of your IDE settings
// https://raw.githubusercontent.com/muet/EspruinoDocs/master/modules
const SWBtn = require("SWButton");
const advertisingInterval = 60000;
const eventTimeout = 2500;
let buttonState = "none";
let led = 2;
@jptrsn
jptrsn / docker-compose.yml
Created November 10, 2023 16:21
Piped video on raspberry pi 3
version: "3"
services:
pipedfrontend:
image: 1337kavin/piped-frontend:latest
restart: unless-stopped
depends_on:
- piped
container_name: piped-frontend
entrypoint: ash -c 'sed -i s/pipedapi.kavin.rocks/api.fartyparts.work/g /usr/share/nginx/html/assets/* && /docker-entrypoint.sh && nginx -g "daemon off;"'
@jptrsn
jptrsn / Dog Boot Dryer ESPHome
Last active November 29, 2021 22:39
ESP Home firmware code to power a 3D printed, Home Assistant-connected dog and/or glove dryer.
esphome:
name: boot_dryer
platform: ESP8266
board: d1_mini
# WiFi connection, correct these
# with values for your WiFi.
wifi:
ssid: !secret ssid
password: !secret wifi_password
@jptrsn
jptrsn / dupli_jeu.ino
Created February 23, 2020 19:35
Code for Arduino Nano based toy duplicator prop
#include <FastLED.h>
#include <Servo.h>
// Pin assignments
#define BUTTON_PIN 2
#define BUTTON_ENABLE 3
#define LED_PIN 4
#define SERVO_PIN 9
#define BELT_PIN 8
############################################################ Christmas Tree 2018 ###########################################
'stop_action':
alias: Stop Action
sequence:
- condition: state
entity_id: light.christmas_tree
state: 'on'
- service: light.turn_off
data:
entity_id: light.christmas_tree
var lightSwitch = 0;
var persist = 30000;
var beaconService = require("ble_ibeacon");
var timerId = null;
var flasherId = null;
const blinkPattern = [100, 150, 100, 150];
function beaconData() {
return {
uuid : [0xb1, 0xae, 0x51, 0x2b, 0x97, 0x03, 0x4a, 0xe2, 0xb9, 0xc3, 0x9e, 0x26, 0x0c, 0xa7, 0xb3, 0x99],
/* script example to retrieve question IDs from form questions, useful for building pre-filled URLs for form entry.
* Copyright 2015, James Petersen
* Published under a Creative Commons Attribution - NonCommercial ShareAlike 4.0 International Licence
*/
function getFormQuestions() {
var form = FormApp.openById(REF_FORM_ID);
var items = form.getItems();
var currentItem;
var validationRules = [];
var questionHeaders = [[],[],[],[]];
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Share to Classroom" title_url="http://www.opensourceteacher.ca/apps-script/share-to-classroom"
description="Add a button to share the current page to Google Classroom."
thumbnail="https://www.gstatic.com/classroom/logo_square_48.svg"
screenshot="https://www.gstatic.com/classroom/logo_square_48.svg"
height="32" width="32" author="Open Source Teacher">
<Require feature="dynamic-height"/>
</ModulePrefs>
<UserPref name="size" display_name="Size" datatype="enum" required="true" default_value="32">
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs
title="List Data Type Example"
scrolling="true"/>
<UserPref name="mylist"
display_name="Add Terms"
datatype="list" />
<Content type="html">
<![CDATA[
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Twitter Timeline"
description="Add a twitter timeline."
thumbnail="http://www.gstatic.com/sites-gadgets/common/images/sites-icon-gadget-thumb.png"
screenshot="http://www.gstatic.com/sites-gadgets/common/images/sites-icon-gadget-ss.png"
author="Open Source Teacher"
height="600" width="250"
/>
<UserPref name="handle" display_name="Twitter Handle (no @ symbol)" required="true"/>