Skip to content

Instantly share code, notes, and snippets.

View ravnoor's full-sized avatar

Ravnoor Singh Gill ravnoor

View GitHub Profile
# Here are a few methods for getting text from PDF files. Do read through
# the instructions carefully! NOte that this code is written for Windows 7,
# slight adjustments may be needed for other OSs
# Tell R what folder contains your 1000s of PDFs
dest <- "G:/somehere/with/many/PDFs"
# make a vector of PDF file names
myfiles <- list.files(path = dest, pattern = "pdf", full.names = TRUE)
#!/bin/bash
# Default Variable Declarations
DEFAULT="Default.txt"
FILEEXT=".ovpn"
CRT=".crt"
KEY=".3des.key"
CA="ca.crt"
TA="ta.key"
@ravnoor
ravnoor / osx-for-hackers.sh
Created December 17, 2015 19:54 — forked from matthewmueller/osx-for-hackers.sh
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@ravnoor
ravnoor / osx-for-hackers.sh
Last active December 20, 2015 22:58 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: El Capitan Edition [Hopefully]. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/bash
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# and here
# https://gist.github.com/brandonb927/3195465
# Set the colours you can use
black='\033[0;30m'
@ravnoor
ravnoor / prepare_images
Created January 31, 2016 23:31 — forked from xpac27/prepare_images
Prepare images for Francoiscogne.com's backoffice
#!/bin/bash
# Requires: brew install imagemagick --with-little-cms --with-little-cms2
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo ""
echo ""
echo ""
echo ""
echo "All the images in the following folder will be changes: "
@ravnoor
ravnoor / pubmed_ask.r
Created August 11, 2016 23:15 — forked from briatte/pubmed_ask.r
pubmed scraper
#' Get a PubMed search index
#' @param query a PubMed search string
#' @return the XML declaration of the search
#' @example
#' # Which articles discuss the WHO FCTC?
#' pubmed_ask("FCTC OR 'Framework Convention on Tobacco Control'")
pubmed_ask <- function(query) {
# change spaces to + and single-quotes to URL-friendly %22 in query
query = gsub("'", "%22", gsub(" ", "+", query))
@ravnoor
ravnoor / _verify-repair-permissions-disk.md
Created February 11, 2017 17:16 — forked from bzerangue/_verify-repair-permissions-disk.md
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@ravnoor
ravnoor / Keras.ipynb
Created April 24, 2017 02:38 — forked from prhbrt/Keras.ipynb
V-Net in Keras and tensorflow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ravnoor
ravnoor / simple_mlp_theano.py
Created April 26, 2017 11:42 — forked from vinhkhuc/simple_mlp_theano.py
Simple Feedforward Neural Network using Theano
# Implementation of a simple MLP network with one hidden layer. Tested on the iris data set.
# Requires: numpy, sklearn, theano
# NOTE: In order to make the code simple, we rewrite x * W_1 + b_1 = x' * W_1'
# where x' = [x | 1] and W_1' is the matrix W_1 appended with a new row with elements b_1's.
# Similarly, for h * W_2 + b_2
import theano
from theano import tensor as T
import numpy as np
from sklearn import datasets
@ravnoor
ravnoor / python-parfor.py
Created July 4, 2017 15:10 — forked from jasimpson/python-parfor.py
Example code to demonstrate parallel for (parfor) loop implementation using joblib
# Example code to demonstrate parallel for loop implementation using joblib
from joblib import Parallel, delayed
import multiprocessing
# Vars
my_list = range(10)
squares = []
# Function to parallelize
def find_square(i):