Skip to content

Instantly share code, notes, and snippets.

View msampathkumar's full-sized avatar

Sampath Kumar msampathkumar

View GitHub Profile
@msampathkumar
msampathkumar / pg-pong.py
Created May 25, 2017 10:45 — 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
@msampathkumar
msampathkumar / Anime Updates Script.py
Last active April 26, 2017 05:04
Adding Filename Extension
'''To fetch top 5 lastest Episodes & Release Dates from Anime Websites.'''
import requests
from bs4 import BeautifulSoup
from IPython.core.display import display, HTML
SAMURAI_JACK_SITE_URL = "http://www.toonova.net/samurai-jack-season-5"
MY_HERO_ACADEMIA_SITE_URL = "http://watchmha2.com/"
DBZ_SUPER_SITE_URL ="http://watchdbzsuper.tv/"
@msampathkumar
msampathkumar / Spark Dataframe Cheat Sheet.py
Created January 19, 2017 11:53 — forked from evenv/Spark Dataframe Cheat Sheet.py
Cheat sheet for Spark Dataframes (using Python)
# A simple cheat sheet of Spark Dataframe syntax
# Current for Spark 1.6.1
# import statements
from pyspark.sql import SQLContext
from pyspark.sql.types import *
from pyspark.sql.functions import *
#creating dataframes
df = sqlContext.createDataFrame([(1, 4), (2, 5), (3, 6)], ["A", "B"]) # from manual data
@msampathkumar
msampathkumar / gist:5cc4655f9a276da5dce3
Created February 27, 2016 07:33
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
#!/usr/bin/python
import subprocess
import re
# Get process info
ps = subprocess.Popen(['ps', '-caxm', '-orss,comm'], stdout=subprocess.PIPE).communicate()[0]
vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0]
# Iterate processes