Skip to content

Instantly share code, notes, and snippets.

View LMBernardo's full-sized avatar
🙉
Focusing

Layne Bernardo LMBernardo

🙉
Focusing
View GitHub Profile
import 'package:http/http.dart' as http;
Future<bool> sendPost() async {
Map<String,String> headers = {
"Accept": "application/json",
"content-type": "application/json",
};
var response = await http.post(
Uri.parse('https://httpbin.org/post'),
@LMBernardo
LMBernardo / parse_dashboard_js_console_batch.js
Last active May 1, 2022 00:49
Batch object processing code intended for use in the Parse Dashboard Javascript API console
/////////// Job Settings ///////////
const itemsPerCycle = 1000; // Recommended < 1001
const maxCycles = 10;
const asyncBatchSize = 10; // Recommended < 11 to not slow down server
const msgPerCycle = 1; // Set low to prevent log spam with large cycle counts
const objectType = new Parse.Object("Product");
// Context values
let flagQ = new Parse.Query(new Parse.Object("Flag"));
flagQ.equalTo("name", "clothing");
@LMBernardo
LMBernardo / esp32_c_cpp_properties.json
Last active August 29, 2021 20:15
(Relatively) generic ESP32 build configuration for VSCode, using IDF v4.3. Requires setting IDF_PATH and IDF_TOOLS_PATH environmental variables.
{
"configurations": [
{
"name": "ESP32",
"includePath": [
"${default}",
"${workspaceFolder}",
"${workspaceFolder}/main",
"${workspaceFolder}/components/**",
"${workspaceFolder}/build/config",
@LMBernardo
LMBernardo / mountall.sh
Created June 22, 2021 08:40
Mount all partitions on a drive in folders corresponding to the partition, e.g., /mnt/sda/sda1
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"; exit
fi
if [ -z "$1" ]; then
echo "The syntax is 'mountall.sh device_path [mount_path]'"; exit
fi
@LMBernardo
LMBernardo / log_introspection.js
Last active December 22, 2022 01:23
Defines functions that can be used for introspection when logging in JS V8 and NodeJS. Originally found here: https://stackoverflow.com/questions/14172455/get-name-and-line-of-calling-function-in-node-js
if (!global.hasOwnProperty("__DEBUG_LOG_INTROSPECTION__")) {
Object.defineProperty(global, '__stack', {
get: function () {
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function (_, stack) {
return stack;
};
var err = new Error;
Error.captureStackTrace(err, arguments.callee);