Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am divyenduz on github.
  • I am divyenduz (https://keybase.io/divyenduz) on keybase.
  • I have a public key whose fingerprint is 283C E7E2 42C0 F59D 2253 5A77 8700 9C7E 9F4F 4DEB

To claim this, I am signing this object:

@divyenduz
divyenduz / distance-serial.ino
Last active Mar 6, 2021
HC-SR04 (Ultrasonic range module) + Arduino + Pushbutton
View distance-serial.ino
// HC-SR04 (Ultrasonic range module)
#define buttonPin 2
#define ledPin 7
#define trigPin 11
#define echoPin 13
float duration, distance;
@divyenduz
divyenduz / divu-nginx-async-nginx.conf
Last active Nov 6, 2017
divu-nginx-async-nginx.conf
View divu-nginx-async-nginx.conf
http {
proxy_read_timeout 20;
proxy_cache_path /var/cache/nginx/cache_content levels=1:2 keys_zone=cache_content:10m
inactive=24h max_size=100m;
proxy_cache cache_content;
proxy_cache_valid 200 20s;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_cache_background_update on;
View divu-nginx-async-micro.js
const sleep = require("then-sleep");
var rn = require("random-number");
module.exports = async (req, res) => {
await sleep(10000);
const generator = rn.generator({
min: 0,
max: 1000,
integer: true
});
@divyenduz
divyenduz / resize-gcf.js
Created Aug 27, 2017
Layout of Google Cloud Function to resize images
View resize-gcf.js
exports.resizeImages = function resizeImages(event, callback) {
var uri = `gs://${event.data.bucket}/${event.data.name}`; // Grab a hold of the dropped image
// Logic to resize and store back in bucket
// On error call callback like callback("Error description", null)
// On success call callback like (null, "Image processing done")
// Callback is in errback format
callback(null, "Image processing done")
};