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
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
getMenuInflater().inflate(R.menu.app_menu, menu); | |
//Only display the menu if the app is in Override mode | |
if (mIsOverride) { | |
//First add the click listener for the menu item | |
MenuItem mItem = menu.findItem(R.id.menu_item_one_time_code); | |
mItem.setOnMenuItemClickListener( | |
new MenuItem.OnMenuItemClickListener() { | |
@Override |
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
var validArgs = ['some_command', 'another_command']; | |
//================================================================= | |
//First lets sort out the command line arguments | |
//================================================================= | |
var userArgs; | |
//Is the first item 'node'? then we're testing | |
if (process.argv[0].toLowerCase() == 'node') { | |
//whack the first two items off of the list of arguments | |
//This removes the node entry as well as the module name entry (the |
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
window.onerror = function (msg, url, line) { | |
var idx = url.lastIndexOf("/"); | |
if (idx > -1) { | |
url = url.substring(idx + 1); | |
} | |
//Build the message string we'll display to the user | |
var errStr = "ERROR in " + url + " (line #" + line + "): " + msg; | |
//Write the error to the console | |
console.error(errStr); | |
//Tell the user what happened |
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
#!/usr/bin/env python | |
in_str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ' | |
out_str = 'jklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghi' | |
def encrypt1(the_string): | |
the_result = '' | |
for x in the_string: | |
pos = in_str.find(x) | |
the_result += out_str[pos] |
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
# Advent Scheduler | |
# By John M. Wargo | |
# Based on initial work by Jannis Jaeger | |
import random | |
# Constants | |
ADVENT_DAYS = 25 | |
# NAMES = ["Anna", "John", "Elizabeth", "August", "Jannis"] | |
NAMES = ["Anna", "John", "Elizabeth", "August"] |
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
ECHO OFF | |
REM set UPLOAD_PORT=COM6 | |
REM Do we have the `VCToolsVersion` environment variable? | |
IF "%VCToolsVersion%"=="" ( | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" | |
pushd %IDF_PATH% | |
call %IDF_TOOLS_PATH%\idf_cmd_init.bat C:\Python39\ "C:\Program Files\Git\cmd\" | |
popd | |
) ELSE ( | |
echo: |
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
// Adafruit Sample Sketch modified to not use Interrupts | |
// Documented here: https://randomerrors.dev/posts/2023/esp32-and-the-adafruit-music-maker-featherwing/ | |
// Specifically for use with the Adafruit Feather, the pins are pre-set here! | |
// include SPI, MP3 and SD libraries | |
#include <SPI.h> | |
#include <SD.h> | |
#include <Adafruit_VS1053.h> |
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
/*! | |
@file DFRobot_mmWave_Radar.ino | |
@ Read whether there is people or object moving in the detection range of the sensor. | |
@ The sensor detection range and output delay time can be configured. Also you can restore the sensor to factory default settings. | |
@n Experimental phenomenon: When the sensor starts successfully, 0 or 1 will be printed on the serial monitor. | |
@ 0 means that there is no human or object moving in sensing area, 1 means the oppposite. | |
@copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) | |
@licence The MIT License (MIT) | |
@version V1.0 | |
@date 2023-3-13 |
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
#define SMOKE_PIN A0 | |
#define MIN_TIME 1000 | |
#define MAX_TIME 5000 | |
bool isSmoking = false; | |
int timerDuration = 0; | |
unsigned long startTime; | |
void setup() { | |
// configure the output pin to control the smoke generator |
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
#define SMOKE_PIN A0 | |
#define MIN_SMOKE_TIME 1000 | |
#define MAX_SMOKE_TIME 5000 | |
void setup() { | |
// configure the output pin to control the smoke generator | |
pinMode(SMOKE_PIN, OUTPUT); | |
// Enable the Arduino device's onboard LED | |
pinMode(LED_BUILTIN, OUTPUT); | |
} |
OlderNewer