Skip to content

Instantly share code, notes, and snippets.

View AmarPrabhu's full-sized avatar
🎯
Focusing

Amar Prabhu AmarPrabhu

🎯
Focusing
View GitHub Profile
@AditiKhullar
AditiKhullar / text-scrapper.js
Last active December 3, 2019 07:09
Scrapes the text from a given URL into an output file. Initialize the phantomJS module using "module load phantomjs" and then scrape "phantomjs text-scraper.js https://www.coursera.org/course/ml output.txt"
var page = require('webpage').create();
var system = require('system');
var fs = require('fs');
if(system.args.length !== 3) {
console.log('Usage: phantomjs text-scraper.js <url> <output file>');
phantom.exit();
}
var url = system.args[1];
module.exports = {
login : function(req,res){
@razius
razius / chrome-refresh.sh
Last active November 6, 2018 13:50
Watches the folder or files passed as arguments to the script and when detects a change it automatically refreshes the current selected Chrome tab or window.
#!/bin/bash
#
# Watches the folder or files passed as arguments to the script and when it
# detects a change it automatically refreshes the current selected Chrome tab or
# window.
#
# http://razius.com/articles/auto-refreshing-google-chrome-on-file-changes/
#
# Usage:
# ./chrome-refresh.sh /folder/to/watch /some/folder/file_to_watch.html
@tkh44
tkh44 / FileController.js
Last active March 10, 2020 09:04
Simple file upload for sails.js
module.exports = {
get: function (req, res) {
res.sendfile(req.path.substr(1));
},
_config: {
rest: false,
shortcuts: false
}
};
@lamberta
lamberta / coursera-slurp
Last active June 16, 2018 13:34
Download all the lecture videos from a Coursera class index page. Requires phantomjs and wget.
#!/usr/bin/env phantomjs
/**
* Scrapes a Coursera class index page and downloads the
* individual lecture mp4s. Requires phantomjs and curl.
* Usage: ./coursera-slurp [index-url]
*
* If something breaks, it's probably the DOM selector in the
* remote page. Try fiddling with the 'linkSelector' function.
*/
var page = require('webpage').create(),
@alicial
alicial / amz-s3-bucket-policy
Created September 13, 2012 18:26
Amazon S3 Bucket Policy to prevent hot linking
{
"Version": "2008-10-17",
"Id": "0c762de8-f56b-488d-a4a4-20d1cb31df2f",
"Statement": [
{
"Sid": "Allow in my domains",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
@bartimaeus
bartimaeus / install-ruby.sh
Created May 31, 2012 19:55 — forked from ryanb/chef_solo_bootstrap.sh
Install Ruby 1.9.3-p286 on Ubuntu 12.04 LTS
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libxml2-dev libxslt-dev libreadline6-dev libyaml-dev
# apt-get -y install libmysqlclient-dev # uncomment for mysql support
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p286.tar.gz
tar -xvzf ruby-1.9.3-p286.tar.gz
cd ruby-1.9.3-p286/
./configure --prefix=/usr/local
make