Skip to content

Instantly share code, notes, and snippets.

View josegrobles's full-sized avatar
🏠
Working from home

Jose Antonio josegrobles

🏠
Working from home
  • Madrid
View GitHub Profile
@pirate
pirate / request_logging_with_filenames.js
Created March 12, 2021 01:40
Show filename:lineno for every log message in node. Log the time, origin ip, method, and url for every express.js request.
// patch console.log to show filename and line number for every logged message
//
// ./src/index.js:68:9 √ Connected to Sentry
// ./src/index.js:72:9 √ Connected to Stripe
// ./src/index.js:82:9 √ Connected to Backblaze
// ./src/index.js:99:9 √ Connected to FireBase
// ./src/routes/paypal.js:68:17 Error: Request failed with status code 401
// at createError (./node_modules/axios/lib/core/createError.js:16:15)
// at settle (./node_modules/axios/lib/core/settle.js:17:12)
// at IncomingMessage.handleStreamEnd (./node_modules/axios/lib/adapters/http.js:236:11)
@nadavrot
nadavrot / Matrix.md
Last active May 8, 2024 18:53
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@amarzavery
amarzavery / package.json
Created February 15, 2018 21:30
simple send receive using rhea
{
"name": "test-rhea",
"version": "0.1.0",
"dependencies": {
"rhea": "*",
"uuid": "*"
}
}
@eerwitt
eerwitt / load_jpeg_with_tensorflow.py
Created January 31, 2016 05:52
Example loading multiple JPEG files with TensorFlow and make them available as Tensors with the shape [[R, G, B], ... ].
# Typical setup to include TensorFlow.
import tensorflow as tf
# Make a queue of file names including all the JPEG images files in the relative
# image directory.
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once("./images/*.jpg"))
# Read an entire image file which is required since they're JPEGs, if the images
# are too large they could be split in advance to smaller files or use the Fixed
@adaline
adaline / twitter_update_with_media.coffee
Last active March 10, 2017 21:40
Node.js module for basic Twitter update_with_media support. You will need to install 'request' packages from npm like so: npm install request
fs = require('fs')
path = require('path')
request = require('request')
class twitter_update_with_media
constructor: (@auth_settings) ->
@api_url = 'https://api.twitter.com/1.1/statuses/update_with_media.json'
post: (status, file_path, callback) ->
r = request.post(@api_url, oauth:@auth_settings, callback)
@miguelmota
miguelmota / default
Last active January 30, 2023 02:28
Nginx + Node.js server configuration. Blog post: http://www.miguelmota.com/blog/nodejs-and-ngnix-on-ubuntu/
# The upstream module is the link between Node.js and Nginx.
# Upstream is used for proxying requests to other servers.
# All requests for / get distributed between any of the servers listed.
upstream helloworld {
# Set up multiple Node.js webservers for load balancing.
# max_fails refers to number of failed attempts
# before server is considered inactive.
# weight priorities traffic to server. Ex. weight=2 will recieve
# twice as much traffic as server with weight=1
server <your server ip>:3000 max_fails=0 fail_timeout=10s weight=1;
@johnschimmel
johnschimmel / express_s3_aws-sdk-js.js
Created April 19, 2013 16:00
ExpressJS file upload to S3
exports.new_photo = function(req, res){
// Get File upload information
var filename = req.files.image.filename; // actual filename of file
var path = req.files.image.path; //will be put into a temp directory
var mimeType = req.files.image.type; // image/jpeg or actual mime type
// Create a new blog post
var photoPost = new Photo(); // create Blog object