This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gc | |
import time | |
import math | |
from pimoroni import Button | |
from plasma import WS2812 | |
from servo import ServoCluster, servo2040 | |
from machine import UART, Pin | |
""" | |
An example of applying a wave pattern to a group of servos and the LEDs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simply copy and paste this entire snippe into the browser console (Cmd + Option + J opens the console) from the Amazon orders page (https://www.amazon.com/gp/css/order-history?ref_=nav_AccountFlyout_orders) | |
// For now you'll have to navigate to the next page yourself and re-run this on each page. | |
// Once you've finished running this on all relevant order pages, run the following: | |
// | |
// | |
// const storedData = localStorage.getItem('amazonOrdersCSV'); | |
// downloadCSV(storedData); | |
// | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stepper { | |
public: | |
enum StepDirection { FORWARD, REVERSE }; | |
// ... Other members ... | |
void beginStep(int numSteps, StepDirection direction, int speed) { | |
// Ignore beginStep if the stepper is already stepping | |
if (_inMotion) { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Manually paginate through all rows of the table you want to extract a CSV from | |
// 2. Fill out the right css selector for `tableRowSelector` for the table you want to extract a csv from | |
// 2. Copy and paste the lines below into your browser console from this page: https://transactions.web.vanguard.com/ | |
const tableRowSelector = "table[aria-label='Transactions for account Your Name... — Account Name — Account Number (Self-managed)*'] tr" | |
[...document.querySelectorAll(tableRowSelector)] | |
.map(n => [...n.cells]) | |
.map(c => | |
c.map(n => `"${n.innerText}"`).join(",") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rename_cwd() { | |
cd . || return | |
new_dir=${PWD%/*}/$1 | |
mv -- "$PWD" "$new_dir" && | |
cd -- "$new_dir" | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <WiFiNINA.h> | |
char ssid[] = ""; // your network SSID (name) | |
char pass[] = ""; // your network password | |
WiFiServer server(80); | |
void setup() { | |
Serial.begin(9600); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SCRIPT TO TALK TO GPT3 | |
const prompt = "why am I getting this error" // change me | |
let button = document.querySelectorAll("button")[5]; | |
let textarea = document.querySelector("textarea"); | |
textarea.innerText = prompt; | |
button.dispatchEvent(new Event("click", {bubbles: true})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Files need to be in same directory as this script | |
files = ["rotate_me_1", "rotate_me_2", "rotate_me_3"] | |
# Read more about rotating videos with ffmpeg here | |
# https://www.baeldung.com/linux/ffmpeg-rotate-video#:~:text=transpose%20is%20an%20FFmpeg%20filter,the%20values%20from%200%2D3. | |
# Run this from a new shell session to watch the progress of this script: | |
# `$ while true; do ps aux | grep ffmpeg; sleep 2; clear; done` | |
Task.async_stream( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function()%7BopenGoogleEarthForHotspot()%3B%0Afunction earthUrl(lat%2C lng) %7B%0A return %60https%3A%2F%2Fearth.google.com%2Fweb%2Fsearch%2F%24%7Blat%7D%2C%24%7Blng%7D%60%3B%0A%7D%0A%0Aasync function openGoogleEarthForHotspot() %7B%0A const hotspotAddress %3D getHotspotAddress()%3B%0A const %7B lat%2C lng %7D %3D await getCoordinates(hotspotAddress)%3B%0A window.open(earthUrl(lat%2C lng))%3B%0A%7D%0A%0Aasync function getCoordinates(hotspotAddress) %7B%0A const res %3D await fetch(%0A %60https%3A%2F%2Fapi.helium.io%2Fv1%2Fhotspots%2F%24%7BhotspotAddress%7D%60%0A ).then((res) %3D> res.json())%3B%0A const %7B lng%2C lat %7D %3D res.data%3B%0A%0A return %7B lng%2C lat %7D%3B%0A%7D%0A%0Afunction getHotspotAddress() %7B%0A var xpath %3D "%2F%2F*%5Bcontains(text()%2C'Hotspot address')%5D"%3B%0A var matchingElement %3D document.evaluate(%0A xpath%2C%0A document%2C%0A null%2C%0A XPathResult.FIRST_ORDERED_NODE_TYPE%2C%0A null%0A ).singleNodeValue%3B%0A%0A return matchingElemen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_duplicate(int_array) | |
current_position = int_array[-1] | |
# Step 1: Get our cursor to the end of the int array list, so that we | |
# are guaranteed to be in a loop when we try to find the loop length | |
(int_array.length - 1).times do | |
current_position = int_array[current_position - 1] | |
end | |
loop_start_position = current_position |
NewerOlder