Skip to content

Instantly share code, notes, and snippets.

View msukmanowsky's full-sized avatar
🥳
Building the future of how companies work with elvex!

Mike Sukmanowsky msukmanowsky

🥳
Building the future of how companies work with elvex!
View GitHub Profile
const express = require('express');
const { filesUpload } = require('./middleware');
app = express();
app.post('/upload', filesUpload, function(req, res) {
// will contain all text fields
req.body
// middleware.js
exports.filesUpload = function(req, res, next) {
// See https://cloud.google.com/functions/docs/writing/http#multipart_data
const busboy = new Busboy({
headers: req.headers,
limits: {
// Cloud functions impose this restriction anyway
fileSize: 10 * 1024 * 1024,
}
@msukmanowsky
msukmanowsky / cloud-function-firebase-auth.js
Last active March 14, 2019 16:25
Small Express middleware snippet for Cloud Functions to determine if a user is authenticated via Firebase Auth.
const admin = require('firebase-admin');
function getIdToken(req) {
const authHeader = req.header('Authorization') || '';
const parts = authHeader.split('Bearer ');
if (parts.length === 1) return null;
return parts[1];
}
{
"error": {
"message": "You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.",
"stack": "Error: You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.\n at Object.h [as getState] (https://app.frontapp.com/v2/main.1374c0dee4fbfedf4ec9.js?1374c0dee4fbfedf4ec9:48:82825)\n at B (<anonymous>:1:28201)\n at <anonymous>:1:37657\n at Object.g [as dispatch] (https://app.frontapp.com/v2/main.1374c0dee4fbfedf4ec9.js?1374c0dee4fbfedf4ec9:48:84062)\n at dispatch (<anonymous>:1:40300)\n at https://app.frontapp.com/v2/main.1374c0dee4fbfedf4ec9.js?1374c0dee4fbfedf4ec9:186:5025\n at Object.dispatch (https://app.frontapp.com/v2/main.1374c0dee4fbfedf4ec9.js?1374c0dee4fbfedf4ec9:170:15439)\n at dispatch (
2018-08-17 13:01:07 WARN NativeCodeLoader:62 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2018-08-17 13:01:07 INFO SparkContext:54 - Running Spark version 2.3.1
2018-08-17 13:01:07 INFO SparkContext:54 - Submitted application: pandas_udf
2018-08-17 13:01:07 INFO SecurityManager:54 - Changing view acls to: mikesukmanowsky
2018-08-17 13:01:07 INFO SecurityManager:54 - Changing modify acls to: mikesukmanowsky
2018-08-17 13:01:07 INFO SecurityManager:54 - Changing view acls groups to:
2018-08-17 13:01:07 INFO SecurityManager:54 - Changing modify acls groups to:
2018-08-17 13:01:07 INFO SecurityManager:54 - SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(mikesukmanowsky); groups with view permissions: Set(); users with modify permissions: Set(mikesukmanowsky); groups with modify permissions: Set()
2018-08-17 13:01:08 INFO Utils:54 - Successfully started service 'sparkDriver' on port 51078.
2018-08-1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>AuthTest</title>
</head>
<body>
<button id="sign_in_button">Sign in</button>

Keybase proof

I hereby claim:

  • I am msukmanowsky on github.
  • I am msukmanowsky (https://keybase.io/msukmanowsky) on keybase.
  • I have a public key ASDR9dQAC8XMWg0DhKSTdYP4NYjCoWN1qXLDbrRoI08HGQo

To claim this, I am signing this object:

def marginal_tax_calculator(brackets):
def calculate(amount):
if amount <= 0: return 0
tax = floor = 0
ceil = rate = None
for bracket in brackets:
if len(bracket) == 1:
ceil = float('inf')
rate = bracket[0]

Are you a news nerd on the geekier end of the journalist <=> hacker spectrum? Does the idea of fixing Canada's broken Access to Information system excite you? MuckRock Canada is looking for a python coder with entrepreneurial spirit to join as co-founder.

You will help craft the bid for the Facebook Journalism Project ($100,000), and, if successful, join the project full-time in April, 2018. The MuckRock code base (python/django) is robust and battle-tested in production, but needs to be customized for the Canadian context.

You must be:

  • reasonably fluent in python
  • willing to take ownership of the project
  • comfortable talking to stakeholders
  • able to translate ATI workflow into python
import time
import asyncio
import aiohttp
from bs4 import BeautifulSoup
async def main():
async with aiohttp.ClientSession() as session: