Skip to content

Instantly share code, notes, and snippets.

View serv-inc's full-sized avatar

serv-inc

View GitHub Profile
'''loads pdf file in sys.argv[1], extracts URLs, tries to load each URL'''
import urllib
import sys
import PyPDF2
# credits to stackoverflow.com/questions/27744210
def extract_urls(filename):
'''extracts all urls from filename'''
PDFFile = open(filename,'rb')
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2018 github.com/serv-inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@serv-inc
serv-inc / fix_udacity_android.sh
Last active January 22, 2018 20:14
upgrades udacity's android sources to use the gradle-3.0 plugin of Android Studio 3 -- https://github.com/gshadows/scripts/blob/master/convert-udacity-gradle.sh is more elaborate, this also fixes T10.x
#! /bin/sh
### upgrades udacity's android sources to use the gradle-3.0 plugin of Android Studio 3.
### run this script from the directory you want to upgrade to
for i in $(git ls-files '*build.gradle'); do
grep 'vectorDrawables' $i && echo "$(/bin/pwd)/$i already upgraded? contains vectorDrawables" && exit 1
sed -i'.bak' -e "s/classpath 'com.android.tools.build:gradle:2.2.3'/classpath 'com.android.tools.build:gradle:3.0.0'/g" $i;
sed -i'.bak' "s/buildToolsVersion ['\"]25.0.2['\"]/buildToolsVersion '26.0.2'/g" $i;
sed -i'.bak' -e "s/defaultConfig {/defaultConfig{\n vectorDrawables.useSupportLibrary = true/g" $i;
sed -i'.bak' -e "s/^dependencies {/dependencies {\n compile 'com.android.support:appcompat-v7:26.1.0'/g" $i;
done
@serv-inc
serv-inc / norminv.js
Last active March 13, 2016 15:36 — forked from esarbe/norminv.js
Compute the quantile function for the normal distribution. - like Excel NORMINV
/// Original C++ implementation found at http://www.wilmott.com/messageview.cfm?catid=10&threadid=38771
/// C# implementation found at http://weblogs.asp.net/esanchez/archive/2010/07/29/a-quick-and-dirty-implementation-of-excel-norminv-function-in-c.aspx
/*
* Compute the quantile function for the normal distribution.
*
* For small to moderate probabilities, algorithm referenced
* below is used to obtain an initial approximation which is
* polished with a final Newton step.
*
* For very large arguments, an algorithm of Wichura is used.