Skip to content

Instantly share code, notes, and snippets.

View svaderia's full-sized avatar

Shyamal Vaderia svaderia

View GitHub Profile
@svaderia
svaderia / gist:d2154a8f3c41f087070e71c63cc470db
Created April 22, 2024 18:53 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@svaderia
svaderia / grokking_to_leetcode.md
Created April 22, 2024 00:30 — forked from tykurtz/grokking_to_leetcode.md
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@svaderia
svaderia / alias.sh
Last active March 18, 2020 15:45
Pass argument in alias
alias wrap_args='f(){echo before $@ after; unset -f f; }; f'
@svaderia
svaderia / cloudSettings
Created March 18, 2020 11:01
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-03-18T11:01:04.213Z","extensionVersion":"v3.4.3"}
@svaderia
svaderia / link.md
Created January 25, 2019 18:01
InputStream to String in java
@svaderia
svaderia / curl.md
Created January 25, 2019 07:50 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

# Working example for my blog post at:
# https://danijar.github.io/structuring-your-tensorflow-models
import functools
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def doublewrap(function):
"""
A decorator decorator, allowing to use the decorator to be used without
@svaderia
svaderia / pg-pong.py
Created November 16, 2017 15:20 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@svaderia
svaderia / shift.py
Created October 29, 2017 11:18 — forked from keturn/shift.py
list rotation experiments
"""Toy code for
http://stackoverflow.com/questions/2150108/efficient-way-to-shift-a-list-in-python
Example results of timeAll on my system with Python 2.6.4:
{'shiftCopy': 50.579999999999984,
'shiftExtend': 3.4200000000000017,
'shiftInPlace': 3.4099999999999966,
'shifted': 95.409999999999997}

Perceptron learning algorithm.

Perceptron model contains only input layer and output layer, so it doesn't contain any hidden layers. Output layer consist of only one binary threshold unit. So for now perceptron can only do binary classification.

Learning Algo:

  1. If the output unit is correct, leave the weights as it is.
  2. If the output unit incorrectly outputs 0, add the input vector to the weights.
  3. If the output unit incorrectly outputs 1, substract the input vector from the weights.

This is guaranteed to find the weights that gets the right answer, if such set of weights exists.