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 React, {useState, useEffect, createContext, useContext} from "react"; | |
import debug from 'debug'; | |
import URI from "urijs"; | |
import get from 'lodash.get'; | |
import {StateContextAjaxRequestCache, ProviderAjaxRequestCache} from "./StateContextAjaxRequestCache"; | |
import _ from "lodash"; | |
const log = debug('DjangoRenderFormContext'); | |
export const DjangoRenderFormContext = createContext(); |
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
int size; | |
size = channels * width * height * sizeof(char); | |
unsigned char *image = NULL; | |
image = (unsigned char *) malloc(size); | |
// fill with gray | |
memset(image, 96, size); | |
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 | |
#This script will compile and install a static ffmpeg build with support for nvenc un ubuntu. | |
#See the prefix path and compile options if edits are needed to suit your needs. | |
echo "you must manually install your nvidia drivers first" | |
read -p "Press any key if you have done that..." | |
echo "and you must install cuda manually (if you already installed drivers, deselect 'install drivers' from cuda install):" | |
echo "wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run" | |
echo "sudo sh cuda_10.1.243_418.87.00_linux.run" |
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
""" | |
Copyright (c) <year> <copyright holders> | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
int x = 0; | |
for (int i = 0; i < buffSize; i++) | |
{ | |
x = i % 32; | |
if (x == 0) | |
{ | |
Serial.print("\n"); | |
} | |
Serial.printf("%02X: ", data_out[i]); | |
Serial.flush(); |
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
Serial.printf("---> %04X : foo\n", (uint32_t) u32); | |
//Serial.printf("---> %04X (%d): \n", (uint32_t) u32, (uint16_t) curpos); |
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
unsigned char bytes[4]; | |
bytes[0] = (u32 >> 24) & 0xFF; | |
bytes[1] = (u32 >> 16) & 0xFF; | |
bytes[2] = (u32 >> 8) & 0xFF; | |
bytes[3] = u32 & 0xFF; | |
for(int i = 0; i < 4; i++) | |
{ | |
if (i == 0) Serial.print("0x"); | |
Serial.print(bytes[i], HEX); | |
if (i < 3) Serial.print(":"); |
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
source: https://github.com/earlephilhower/ESP8266Audio/blob/2f2898c49612f1cc1351b44ffe8541def5a26b23/src/AudioGeneratorMIDI.cpp#L71 | |
void AudioGeneratorMIDI::midi_error(const char *msg, int curpos) | |
{ | |
cb.st(curpos, msg); | |
#if 0 | |
int ptr; | |
Serial.printf("---> MIDI file error at position %04X (%d): %s\n", (uint16_t) curpos, (uint16_t) curpos, msg); | |
/* print some bytes surrounding the error */ | |
ptr = curpos - 16; |
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
// this is a hack of: | |
// https://github.com/gtalusan/esp-idf/blob/master/examples/bluetooth/a2dp_source/main/main.c | |
// the idea is to be able to play an audio file from an esp32's flash memory directly to a bluetooth audio speaker | |
// refer to here for the notes on what you need to do to pull it all together | |
/* | |
This example code is in the Public Domain (or CC0 licensed, at your option.) | |
Unless required by applicable law or agreed to in writing, this |
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
async function transformImage(dataBytes: any) { | |
//let convert = async(dataBytes: any) => sharp(dataBytes).background({r: 255, g: 255, b: 255, alpha: 0}).toFormat('png').toBuffer() | |
let convert = async(dataBytes: any) => sharp(dataBytes).toFormat('png').toBuffer() | |
dataBytes = await(convert(dataBytes)) | |
return dataBytes | |
} |