Skip to content

Instantly share code, notes, and snippets.

View gauthamzz's full-sized avatar
🐻‍❄️
Building

Gautham Santhosh gauthamzz

🐻‍❄️
Building
View GitHub Profile
@gauthamzz
gauthamzz / fetch_pull_request
Created February 23, 2018 11:58
script to fetch pull request in a new branch.
#!/bin/bash
if [ "$1" == "--help" ]; then
printf "Usage: fetch-pull-request [--help] pull_request_id [remote=upstream] \n\n Locally fetch a pull request and test it. \n Remote is set to upstream by default.\n"
exit 1
elif [ $# -eq 0 ]; then
echo "Pull request id not given."
exit 1
else
set -e -x
remote=${2:-upstream}
@gauthamzz
gauthamzz / dfa.py
Created January 10, 2017 11:01
Python DFA code to recognize the reserved keywords.
class Automaton:
def __init__(self, nstates):
self.transitions = [{} for i in range(nstates)]
self.accept_states = [False] * nstates
def register(self, source_state, char, target_state):
self.transitions[source_state][char] = target_state
def register_accept(self, state):
self.accept_states[state] = True