Skip to content

Instantly share code, notes, and snippets.

# pip install selenium bs4
url = 'https://www.amphenol-cs.com/millipacs-10127112102lf.html'
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver import ChromeOptions
options = webdriver.ChromeOptions()
options.add_argument('--headless=new')
import cv2
import numpy as np
from pdf2image import convert_from_path
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("filename", help="Enter a pdf filename to process")
args = parser.parse_args()
// Cross-broswer implementation of text ranges and selections
// documentation: http://bililite.com/blog/2011/01/17/cross-browser-text-ranges-and-selections/
// Version: 2.6
// Copyright (c) 2013 Daniel Wachsstock
// MIT license:
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// Cross-broswer implementation of text ranges and selections
// documentation: http://bililite.com/blog/2011/01/17/cross-browser-text-ranges-and-selections/
// Version: 2.6
// Copyright (c) 2013 Daniel Wachsstock
// MIT license:
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// lighthouse-batch -s -p "--perf --quiet" -f urls-boats.txt -o report-lvb
var parsedJSON = require('./report-lvb/summary.json');
var worst = [];
var seventies = [];
var eighties = [];
var nineties = [];
console.log('Total: '+parsedJSON.length);
for (var r in parsedJSON) {
var row = parsedJSON[r];
var els = document.getElementsByClassName("yt-simple-endpoint");
var links = {};
for (var e in els ) {
if( els[e].href && els[e].href.indexOf('watch')!=-1 ) {
var link = els[e].href.split('&list')[0];
links[link] = link;
}
}
for(var l in Object.keys(links)) {
console.log(l);
@nopium
nopium / blip
Created February 8, 2020 12:01
/*!
* jQuery JavaScript Library v1.4.1
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
@nopium
nopium / min-char-rnn.py
Created February 10, 2017 07:08 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
Directives
==========
Directive calls controller
-------------------------
app.controller("AppCtrl", function($scope) {
$scope.func = function() {
alert("Controller's function published on scope");
}
}
@nopium
nopium / .htaccess
Created June 5, 2016 16:18 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/