Skip to content

Instantly share code, notes, and snippets.

View daenamkim's full-sized avatar
🎯
Focusing

Daenam Kim daenamkim

🎯
Focusing
View GitHub Profile
@bloc97
bloc97 / TwoMethods.md
Last active February 20, 2024 12:19
Two Fast Methods of Generating True Random Numbers on the Arduino

Two Fast Methods of Generating True Random Numbers on the Arduino

Arduino true random number generator

B. Peng

December 2017

Abstract

The AVR series microcontrollers are a collection of cheap and versatile chips that are used in many applications ranging from hobbist projects to commercial infrastructure. One major problem for some hobbists is the lack of secure random number generation on the Arduino platform. The included pseudo-random number generator (PRNG) is very easy to defeat and is useless for any crypto-related uses. One recommendation from the Arduino Reference Manual is to use atmospheric noise from the chip's analog sensor pins as seed data[6].
Unfortunately this method is extremely weak and should not be used to emulate a true random number generator (TRNG). Existing methods such as using the internal timer drift or using a dedicated generator are either too slow, requires extensive external hardware or modifications to the microcontroller's internal mech

@javilobo8
javilobo8 / download-file.js
Last active April 9, 2024 12:01
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@AshikNesin
AshikNesin / react-file-upload.js
Created February 2, 2017 06:46
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
super(props);
this.state ={
file:null
}
@xavierlepretre
xavierlepretre / expected_exception_testRPC_and_geth.js
Last active November 28, 2019 17:57
When TestRPC and Geth throw, they behave in a different manner. This Gist is an example on how to cover such a situation.
"use strict";
/**
* @param {!Function.<!Promise>} action.
* @param {!Number | !string | !BigNumber} gasToUse.
* @returns {!Promise} which throws unless it hit a valid error.
*/
module.exports = function expectedExceptionPromise(action, gasToUse) {
return new Promise(function (resolve, reject) {
try {