Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Gildas Niyigena gildniy

🏠
Working from home
View GitHub Profile
@gildniy
gildniy / heart-disease-prediction-with-keras.py
Created Apr 15, 2021
Classify structured data using Keras Preprocessing Layers
View heart-disease-prediction-with-keras.py
import pandas as pd
import tensorflow as tf
from sklearn.model_selection import train_test_split
from tensorflow.keras.layers.experimental.preprocessing import \
Normalization, CategoryEncoding, IntegerLookup
dataset_url = 'https://storage.googleapis.com/kaggle-data-sets/1226038/2047221/bundle/archive.zip?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=gcp-kaggle-com%40kaggle-161607.iam.gserviceaccount.com%2F20210414%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20210414T143749Z&X-Goog-Expires=259199&X-Goog-SignedHeaders=host&X-Goog-Signature=6cefbf3a9411483ae20d76e70c31f465c92380544351145764bdfb678d88c27622dee6c47cb9d2504859c08df24648c576fb1b8d8af192263f8c2b6485157cca2751d166fdaf358243774c4eaa1677c561af42961344b5c011e8bbfdd8fc1237f1101658d29c57b10cd1e9a5bb816461e05ff2190b520a5ae115147203e2e9c2a042787e26e6c314431e9caad65c7203419c3c52097f1ab00416a928aecba4ee78d2b559d1ea29c0ba68736c7ed2c630ef4574092aec1825f36f228f7aacdc44122ec8bff18a6051d9d74a9445924ceec8d0edf1de4741b465766876f4e27a491a20aded988467b4cef
@gildniy
gildniy / async-wrapper.js
Created Sep 15, 2020
Async wrapper, replacing try catch
View async-wrapper.js
/* The async wrapper, replacing try catch block */
// eslint-disable-next-line no-unused-vars
const asyncWrapper = fn => (...args) => fn(...args).catch(args[2]);
@gildniy
gildniy / dynamodb_batch_delete.js
Created Sep 9, 2020 — forked from rproenca/dynamodb_batch_delete.js
Delete multiple items in a DynamoDB table
View dynamodb_batch_delete.js
const AWS = require('aws-sdk');
const {parallelScan} = require('@shelf/dynamodb-parallel-scan');
const TABLE_NAME = '[table-name]';
const PRIMARY_PARTITION_KEY = '[partition-key]';
async function fetchAll() {
const CONCURRENCY = 250;
const alias = `#${PRIMARY_PARTITION_KEY}`;
const name = PRIMARY_PARTITION_KEY;
View Visual Studio 2017 Enterprise & Professional
Enterprise: NJVYC-BMHX2-G77MM-4XJMR-6Q8QF
Professional: KBJFW-NXHK6-W4WJM-CRMQB-G3CDH
Keys are generic ones. These are the same from MSDN account.
Product Key : -6Q8QF
Validity : Valid
Product ID : 00369-90000-00000-AA703
Advanced ID : XXXXX-03699-000-000000-00-1032-9200.0000-0672017
@gildniy
gildniy / nodeAsyncTest.js
Created Jul 14, 2020 — forked from aescarcha/nodeAsyncTest.js
Javascript async / await resolving promises at the same time test
View nodeAsyncTest.js
// Simple gist to test parallel promise resolution when using async / await
function promiseWait(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(true);
}, time);
});
}
@gildniy
gildniy / delay.js
Created Jul 14, 2020 — forked from eteeselink/delay.js
ES7 async/await version of setTimeout
View delay.js
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
async function something() {
console.log("this might take some time....");
await delay(5000);
console.log("done!")
}
something();
@gildniy
gildniy / index.md
Created Jun 26, 2020 — forked from mathisonian/index.md
requiring npm modules in the browser console
View index.md

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: https://github.com/mathisonian/requirify/issues/5

inspiration

@gildniy
gildniy / setTimeOut.test.js
Created Jun 23, 2020
Why setTimeOut is not always a good option?
View setTimeOut.test.js
// https://jj09.net/settimeout-considered-harmful/
// NO TIMEOUT
let someVar1 = 0;
const changeVar1 = () => {
someVar1 = 10;
return someVar1;
};
@gildniy
gildniy / RecipeItem.js
Created Jan 15, 2020 — forked from pylnata/RecipeItem.js
Jest+Enzyme example unit test with SHALLOW for React component using useEffect and (useDispatch, useSelector) hooks
View RecipeItem.js
import React from "react";
export const Recipeitem = (props) => {
return (<div>
{props.title}
</div>)
}
@gildniy
gildniy / test.spec.jsx
Last active Oct 31, 2019
Testing a React Functional Component using Enzyme
View test.spec.jsx
import React from 'react';
import {shallow} from "enzyme";
const numbersArr = ["One", "Two", "Three"];
const Count123array = () => (
<div className="my-text">
{numbersArr[1]}
</div>
);