Skip to content

Instantly share code, notes, and snippets.


parag gupta paraggupta1993

View GitHub Profile
umount /dev/sdb1
sudo mkdosfs -n 'USB-Drive-Name' -I /dev/sdb -F 32
sudo dd if=filename.iso of=/dev/sdb bs=4k
sudo eject /dev/sdc
# isohybrid filename.iso # only if there is "Missing Operating System" error in booting
paraggupta1993 / tm.js
Created Jun 2, 2015
[Javascript] Turing Machine
View tm.js
function tm(tape, transform, startState, endStates, i){
currState = startState;
while(currState is not in endStates){
sym = (tape[i])? tape[i]: 'Blank';
state = transform[currState][sym];
if(!state) return 'Not Halting';
tape[i] = state.w; // write sym
i += state.m; // move tape
currState = state.n; // move to next state
paraggupta1993 /
Last active Aug 29, 2015
Adding a parameter to URL string using Coffeescript.
@addAttributeToUrl: (url, key, val) ->
return url if _.some arguments, (arg) ->
arg == null or arg == ''
#regex = (all non-# or non-?)(0-1: # or ?)(all non-blanks)
regex = /([^\?#]*)([?#]?)([^\s]*)/
match = regex.exec(url.trim())
baseUrl = match[1]
separator = match[2]
queryString = match[3]
paraggupta1993 / TerminateEvent
Last active Aug 29, 2015
teminateEvent : Stops bubbling-up and propogation of events in EventHandlers.
View TerminateEvent
terminateEvent = function(event){
event.stopPropagation(); // Stops Bubbling up to Ancestor elements
event.preventDefault(); // Stops the default action Eg : Redirecting to a "href" for anchor element
return false;
$("#anchor-element").click( function(event){
//Do something
return terminateEvent();
You can’t perform that action at this time.