Skip to content

Instantly share code, notes, and snippets.

View ShawonAshraf's full-sized avatar
🐈
I'm simply not there.

Shawon Ashraf ShawonAshraf

🐈
I'm simply not there.
View GitHub Profile
@ShawonAshraf
ShawonAshraf / cnn.py
Created November 20, 2020 21:20
TF Apple Fork test on mnist data
import tensorflow as tf
from tensorflow.python.compiler.mlcompute import mlcompute
mlcompute.set_mlc_device(device_name='gpu')
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
@ShawonAshraf
ShawonAshraf / boolean_and_query.py
Created November 16, 2020 21:13
irtm boolean and
paris = [1, 2, 3, 4, 5, 7, 8, 9, 11, 12, 13, 14, 15]
france = [2, 6, 10, 12, 14]
def query(posting1, posting2):
result = []
it1 = iter(posting1)
it2 = iter(posting2)
el1 = next(it1)
@ShawonAshraf
ShawonAshraf / geoplot.py
Created November 6, 2020 13:19
For Tahmid Vai's work
ncols = 3
nrows = 4
# create a figure of dimension nrows X ncols
fig, ax = plt.subplots(nrows=nrows, ncols=ncols, figsize=(20, 15))
# keeps track of the indexes of iaq
df_idx_counter = 0
# iterate through the grid and plot one iaq element in each grid box
@ShawonAshraf
ShawonAshraf / dm-toilet-paper.js
Created October 22, 2020 12:11 — forked from marco79cgn/dm-toilet-paper.js
Scriptable iOS widget that shows the amount of toilet paper which is available at your next dm drugstore
let storeId = 386
let param = args.widgetParameter
if (param != null && param.length > 0) {
storeId = param
}
const storeCapacity = await fetchAmountOfPaper()
const storeInfo = await fetchStoreInformation()
const widget = new ListWidget()
await createWidget()
def merge_sort(arr):
if len(arr) > 1:
middle = len(arr) // 2
left = arr[:middle]
right = arr[middle:]
merge_sort(left)
merge_sort(right)
@ShawonAshraf
ShawonAshraf / alex_torch.py
Created July 7, 2020 11:27
Alexnet draft PyTorch
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data as data
import skimage
import skimage.io
import skimage.transform
@ShawonAshraf
ShawonAshraf / data_helpers.py
Created May 28, 2020 10:15
Text Classification CNN Keras
"""
Taken from https://github.com/alexander-rakhlin/CNN-for-Sentence-Classification-in-Keras
"""
import numpy as np
import re
import itertools
from collections import Counter
"""
@ShawonAshraf
ShawonAshraf / Dockerfile
Created May 12, 2020 22:28
node-express docker medium
FROM node:10.11-alpine
WORKDIR /usr/app
COPY . .
RUN npm install
EXPOSE $PORT
CMD [ "npm", "run", "start" ]
@ShawonAshraf
ShawonAshraf / package.json
Created May 12, 2020 22:27
node-express-docker-medium
"scripts": {
"start": "npm run build && node build/server.js",
"build": "npm run clean && npm run babel-build",
"clean": "rimraf ./build",
"babel-build": "./node_modules/.bin/babel src/ --out-dir build/ --ignore ./node_modules/,./babelrc,./package.json,./package-lock.json,./npm-debug.log --copy-files",
"eslint-init": "./node_modules/.bin/eslint --init",
"test": "echo \"Error: no test specified\" && exit 1"
},
@ShawonAshraf
ShawonAshraf / server.js
Created May 12, 2020 22:25
node-express-medium
import express from 'express';
import morgan from 'morgan';
import bodyParser from 'body-parser';
const app = express();
app.use(morgan('combined'));
app.use(bodyParser.json());
app.get('/', (req, res) => {