Skip to content

Instantly share code, notes, and snippets.

@ujwaltrivedi
ujwaltrivedi / makePythonLambdaPackage.sh
Last active March 7, 2020 13:35
Make Python Lambda Package
#!/usr/bin/env bash
# doesn't need virtual env
# you should still create one to test your code.
pip3 install --target ./packages pymysql
cd packages
zip -r9 ${OLDPWD}/function.zip .
@ujwaltrivedi
ujwaltrivedi / interview-questions.md
Created February 23, 2020 03:51 — forked from jvns/interview-questions.md
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

@ujwaltrivedi
ujwaltrivedi / keras_bottleneck_multiclass.py
Created January 15, 2019 02:26 — forked from Thimira/keras_bottleneck_multiclass.py
Learn how to build a multi-class image classification system using bottleneck features from a pre-trained model in Keras to achieve transfer learning. Tutorial: https://www.codesofinterest.com/2017/08/bottleneck-features-multi-class-classification-keras.html
'''
Using Bottleneck Features for Multi-Class Classification in Keras
We use this technique to build powerful (high accuracy without overfitting) Image Classification systems with small
amount of training data.
The full tutorial to get this code working can be found at the "Codes of Interest" Blog at the following link,
https://www.codesofinterest.com/2017/08/bottleneck-features-multi-class-classification-keras.html
Please go through the tutorial before attempting to run this code, as it explains how to setup your training data.
# projecteuler problem 4
def pep4():
max_palindrome = 0
for n1 in range(1000, 100, -1):
for n2 in range(1000, 100, -1):
if n2 >= n1:
mult = n1*n2
if is_palindrome(mult):
@ujwaltrivedi
ujwaltrivedi / pep3.py
Created May 21, 2016 01:38
https://repl.it/CT3w/0 created by ujwaltrivedi
# projecteuler problem 3
def pep3(num):
n = 2
nx = num
arr = []
while n*n < num:
if nx % n == 0:
nx //= n
arr.append(n)
else:
@ujwaltrivedi
ujwaltrivedi / pep2.py
Last active May 21, 2016 01:00
https://repl.it/CT3e/1 created by ujwaltrivedi
# projecteuler problem 2
def pep2():
even_fibo_sum(4000000)
def even_fibo_sum(n):
x = 1
y = 2
sum = 2
@ujwaltrivedi
ujwaltrivedi / pep1.py
Last active May 21, 2016 01:00
https://repl.it/CT3U/2 created by ujwaltrivedi
# projecteuler problem 1
def pep1(n):
sum = 0
for x in range(1,n):
if x % 3 == 0:
sum += x
elif x % 5 == 0:
sum += x
print(sum)
@ujwaltrivedi
ujwaltrivedi / consec.py
Last active May 20, 2016 19:23
Consecutive Characters
class Node:
def __init__(self, char):
self.char = char
self.num = 0
def consec(str):
arr = []
@ujwaltrivedi
ujwaltrivedi / kmp.py
Created January 24, 2016 00:13
KMP Algorithm - Python 3
"""
KMP Text Search - O(m + n)
m = haystack
n = needle
"""
def kmp(T, P):
n, m = len(T), len(P)
j = 0
k = 0
'''
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.