View char_rnn_karpathy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
from __future__ import print_function | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) |
View python_snippet.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
student = ["A", "B", "C", "D", "E"] | |
marks = [21, 35, 13, 26, 49] | |
n = len(marks) | |
count = 0 | |
count1 = 0 | |
for i in range(n): | |
if marks[i] >= 25: | |
print student[i] + "has passed" | |
count = count + 1 | |
else: |
View matlab_snippet.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
student = [‘A’, ’B’, ’C’, ’D’, ’E’]; | |
marks = [21, 35, 13, 26, 49]; | |
n = length(marks); | |
count = 0; | |
count1 = 0; | |
for i = 1:n | |
if marks(i) >= 25 | |
fprintf(‘ %s has passed\n’,student(i)); | |
count = count + 1; | |
else |
View commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To start ffserver | |
ffserver -f /etc/ffserver.conf | |
// re stream incoming to ffsever | |
ffmpeg -rtsp_transport tcp -i "rtsp://admin:admin@65.254.18.55:7314/live/N4NXL/1/2" http://localhost:8090/camera.ffm | |
// configuration file |
View simple_language_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import string | |
from string import punctuation | |
# Get all the alphabets | |
alphabetsList = list(string.ascii_letters) | |
# Get all the punctuations | |
punctuationList = list(punctuation) |
View single_linked_list_ops.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node(): | |
""" | |
Basic component for single linked list - A node | |
A node consist of a value and a pointer to another node | |
""" | |
def __init__(self, data): | |
self.val = data | |
self.next = None | |
View stack_using_linked_list.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node(object): | |
""" | |
Fundamental building block of a linked list | |
A node consists of a value and the next node location pointer | |
""" | |
def __init__(self, value): | |
self.val = value | |
self.next = None |
View queue_using_linked_list.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node(object): | |
""" | |
Fundamental building block of a linked list | |
A node consists of a value and the next node location pointer | |
""" | |
def __init__(self, value): | |
self.val = value | |
self.next = None |
View binary_search.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def binary_search(a_list, search_item): | |
""" | |
Binary search using loop on a sorted list | |
Based on the value we look for, bifurcate the list into two look up windows. | |
The value we look for is the middle value of current window. | |
If search value < middle value of the window, put the upper bound to middle value | |
If search value > middle value of the window, put the lower bound to middle value |
View bitwise_operations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_bit(x, pos): | |
""" | |
First create a mask which has 1 in the required position and everywhere else is 0 | |
Then do bitwise OR that will the set 1 in the position | |
""" | |
mask = 1 << pos | |
return x | mask | |
def clear_bit(x, pos): | |
""" |
OlderNewer