Skip to content

Instantly share code, notes, and snippets.

View callmephilip's full-sized avatar

Philip Nuzhnyi callmephilip

View GitHub Profile
@callmephilip
callmephilip / visualize_data_bunch.py
Created May 7, 2020 11:33
Helper for debugging FastAI image data bunches
from fastai.vision import *
import pandas as pd
import matplotlib
from matplotlib.gridspec import GridSpec
def visualize_data_bunch(db, figsize=(16,16), layoutRows=3, layoutCols=5):
graphRows = 4
layout = { "rows": layoutRows + graphRows, "cols": layoutCols }
graphCols = int(layoutCols * 0.75)
{"layer1": {"weights": [[-0.07274463772773743, -0.05483248457312584, -0.03770652413368225, -0.03742086514830589, -0.050161924213171005, -0.06178945675492287, -0.05419166386127472, -0.022179512307047844, -0.029363859444856644, -0.042349692434072495, -0.008726662024855614, 0.007980101741850376, 0.05518602579832077, 0.04311336204409599, 0.01887792907655239, -0.025796234607696533, -0.026308175176382065, -0.06663032621145248, -0.11316043138504028, -0.06160087138414383, -0.050536155700683594, -0.045753899961709976, -0.010632967576384544, 0.011841720901429653, -0.007426648400723934, -0.010910416021943092, -0.03271804749965668, -0.004095158539712429, -0.042311426252126694, -0.06080005317926407, -0.019534414634108543, 0.017563525587320328, -0.010229254141449928, -0.009893407113850117, -0.025845041498541832, -0.062347691506147385, -0.011849354021251202, -0.029188185930252075, -0.012888552621006966, 0.04048076272010803, 0.01928851194679737, 0.024348542094230652, 0.027422353625297546, 0.05658775940537453, 0.0403093323111
app.get('/', (req, res) => {
// When logged in user object is attached to the request
if (!req.user) {
res.redirect('/login');
return;
}
res.send(`Hello ${req.user.emails[0].address}`);
});
app.get('/login', (req, res) => {
app.use('/api', passport.authenticate('basic', { session: false }));
app.post('/api/ping', (req, res) => {
res.send(`pong ${req.user.emails[0].address}`);
});
function deserializeUserPassport(id, done) {
User.findOne({ _id: id }, (err, userModel) => {
if (err) {
done(err);
} else {
if (!userModel) {
done();
return;
}
done(null, userModel.toJSON());
function comparePasswords(password, hash, callback) {
bcrypt.compare(crypto.createHash('sha256').update(password).digest('hex'), hash, callback);
}
new LocalStrategy(function getUserPassport(username, password, done) {
User.findOne({
'emails.address': username,
}, (findError, userModel) => {
if (findError) {
return done(findError);
@callmephilip
callmephilip / passport-meteor-accounts-server.js
Last active March 28, 2020 19:54
Passport.js + Meteor accounts
// http://blog.thebakery.io/meteor-accounts-auth-with-passportjs/
import bcrypt from 'bcrypt';
import crypto from 'crypto';
import express from 'express';
import mongoose from 'mongoose';
import passport from 'passport';
import { Strategy as LocalStrategy } from 'passport-local';
import { BasicStrategy } from 'passport-http';
const User = mongoose.model('users', new mongoose.Schema({
fastlane_version "1.105.0"
platform :android do
desc "Submit a new Beta Build to Google Play"
lane :beta do
gradle(task: 'clean', project_dir: "android/")
gradle(task: "assemble", build_type: "Release", project_dir: "android/")
supply(track: "beta", apk: "android/app/build/outputs/apk/app-release.apk")
end
end
class TodoList extends Component {
renderList() {
const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2, });
return (
<ListView
dataSource={ds.cloneWithRows(this.props.todos.toJS())}
renderRow={this.renderRow} />
);
}
---
format_version: 1.2.0
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
app:
envs:
- opts:
is_expand: false
FASTLANE_WORK_DIR: app
- opts:
is_expand: false