Skip to content

Instantly share code, notes, and snippets.

View sengupta's full-sized avatar

Aditya Sengupta sengupta

View GitHub Profile
@sengupta
sengupta / hi.png
Created June 18, 2010 04:22
Generate a "Hi" 3D plot in Scilab
hi.png
@sengupta
sengupta / fizzbuzz.sce
Created May 8, 2011 18:31
The popular Fizz-Buzz program in Scilab.
// See http://en.wikipedia.org/wiki/Fizz_buzz
List = 1:100;
Fizz = find(modulo(List, 3) == 0);
Buzz = find(modulo(List, 5) == 0);
FizzBuzz = find(modulo(List, 3*5) == 0);
strList = string(List);
strList(Fizz) = "Fizz";
strList(Buzz) = "Buzz";
@sengupta
sengupta / RandomWalk.sce
Created May 8, 2011 18:33
One Dimensional Random Walk
// One Dimensional Random Walk
// http://en.wikipedia.org/wiki/Random_walk
PossibleSteps = [1, -1] // Assuming you can only go ahead by one step or backwards by one step
Start = 0 // Start at 0 on the number line
NumberOfSteps = 1000
StepsTaken = sample(NumberOfSteps, PossibleSteps); // Take a random step ahead or back
n = length(StepsTaken)
@sengupta
sengupta / vandermonde.sci
Created May 8, 2011 18:39
Three ways of generating a Vandermonde matrix
// Three ways of generating a Vandermonde matrix:
function y = vandermonde1(x)
n = length(x)
for i = 1:n
y(:, i) = x^(i-1)
end
endfunction
function y = vandermonde2(a)
#!/bin/bash
# dcyoutube.shyoutube-url [Output MP3 Name]
URL=$1
FILENAME=`youtube --get-filename $URL`
if [ -z $2]; then
NAME=`youtube -e $URL`
else
@sengupta
sengupta / JavaScript
Created December 11, 2011 20:02 — forked from apnerve/like
Facebook like bookmarklet
javascript:(function(){try{var%20url=encodeURIComponent(location.href);var%20ifr=document.createElement('iframe');ifr.style.position='absolute';ifr.style.top=10+'px';ifr.style.left=10+'px';ifr.style.width=450+'px';ifr.style.height=100+'px';ifr.style.border='none';ifr.style.backgroundColor="#fff";ifr.src='http://www.facebook.com/plugins/like.php?href='+url+'&show_faces=true&width=450&action=like&colorscheme=light';ifr.scrolling='no';ifr.frameborder=0;document.getElementsByTagName('body')[0].appendChild(ifr);}catch(e){}})();
// This was written for Chandni 14-Dec-2011
//
// Problem Statement:
//
// Assuming you have two files, d1.txt and d2.txt. You would like to remove all
// entries from d2.txt that also appear in d1.txt
d1 = read_csv('d1.txt');
d2 = read_csv('d2.txt', ', ')';
@sengupta
sengupta / LICENSE.txt
Created January 16, 2012 18:46
Email Scraper
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
@sengupta
sengupta / README.md
Created March 9, 2012 14:50
Reliance Netconnect Plus Prepaid Balance Checker

Reliance Netconnect Plus Prepaid Balance Checker

This is a small shell script that checks your Reliance Netconnect Prepaid account balance and emails it to a designated email address.

The Netconnect number and email address are to be saved in a file called .netconnectrc in your home directory with the following variables:

netconnect_number="1234567890"
email_addresses="comma separated list of email addresses"
@sengupta
sengupta / lighting_talk.rst
Created April 5, 2012 19:45 — forked from GaelVaroquaux/lighting_talk.rst
Bootstrapping a SciPy-related community project

Bootstrapping a SciPy-related community project

This document is a lightning talk: it only gives pointers, you need to Google and read references

Goal