Skip to content

Instantly share code, notes, and snippets.

@vb100
vb100 / zoopla_rents.py
Last active August 4, 2022 23:58
Zoopla.com scrapper for get rents data
""" Zoopla scraping project """
# Import libraries
import requests, re, os
import pandas as pd
from bs4 import BeautifulSoup
""" Generate the list of URLs : Start"""
def generateURLs(pages):
listURLs = []
@KingsleyOmon-Edo
KingsleyOmon-Edo / ubuntu-17.10-post-install.sh
Last active August 15, 2018 22:29
A post installation script for installing selected application on Ubuntu 17.10.
#!/bin/bash
curl_check ()
{
echo "Checking for curl..."
if command -v curl > /dev/null; then
echo "Detected curl..."
else
echo "Installing curl..."
apt-get install -q -y curl
@scivision
scivision / opencv3-extras-cmake-output.txt
Last active July 25, 2019 03:03
CMake output from OpenCV 3 + OpenCV 3 contrib extra modules
# on Ubuntu 17.10
# https://www.scivision.dev/compiling-opencv3-with-extra-contributed-modules/
$ cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ -DBUILD_TIFF=ON -DBUILD_opencv_java=OFF -DWITH_CUDA=OFF -DWITH_OPENGL=ON -DWITH_OPENCL=ON -DWITH_IPP=ON -DWITH_TBB=ON -DWITH_EIGEN=ON -DWITH_V4L=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)") -DPYTHON_EXECUTABLE=$(which python) -DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") ..
-- The CXX compiler identification is GNU 7.2.0
-- The C compiler identification is GNU 7.2.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
@pachadotdev
pachadotdev / r_ubuntu_17_10.sh
Last active June 25, 2019 05:43
Install R on Ubuntu 17.10
# Install R
sudo apt-get update
sudo apt-get install gdebi libxml2-dev libssl-dev libcurl4-openssl-dev libopenblas-dev r-base r-base-dev
# Install RStudio
cd ~/Downloads
wget https://download1.rstudio.org/rstudio-xenial-1.1.383-amd64.deb
sudo gdebi rstudio-xenial-1.1.383-amd64.deb
printf '\nexport QT_STYLE_OVERRIDE=gtk\n' | sudo tee -a ~/.profile
@Morreski
Morreski / timed_cache.py
Last active September 3, 2024 00:29
Python lru_cache with timeout
from datetime import datetime, timedelta
import functools
def timed_cache(**timedelta_kwargs):
def _wrapper(f):
update_delta = timedelta(**timedelta_kwargs)
next_update = datetime.utcnow() + update_delta
# Apply @lru_cache to f with no cache size limit
import torch
import torch.nn as nn
import torch.nn.parallel
class DCGAN_D(nn.Container):
def __init__(self, isize, nz, nc, ndf, ngpu, n_extra_layers=0):
super(DCGAN_D, self).__init__()
self.ngpu = ngpu
assert isize % 16 == 0, "isize has to be a multiple of 16"
@tuan3w
tuan3w / ALS2.scala
Last active June 16, 2020 20:23
Implementation of Biased Matrix Factorization on Spark
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
@adrianseeley
adrianseeley / app.js
Last active November 9, 2017 06:43
Neural Network with Backpropagation, Bootstrapping and Bagging (Uses MSE)
function mse (errors) {
var sum = 0;
for (var i = 0; i < errors.length; i++) {
sum += Math.pow(errors[i], 2);
}
return sum / errors.length;
};
function zero_array (size) {
var ary = [];
@jcchurch
jcchurch / today.py
Last active August 22, 2024 02:08
Adds line to let bash know that this is a python 3 script.
#!/usr/bin/env python3
import datetime
import argparse
import re
def createDate(stringDate):
if re.match("\d\d\d\d-\d\d-\d\d$", stringDate) is None:
raise ValueError("This is not in the correct date format. Use YYYY-MM-DD")
@drmalex07
drmalex07 / celeryconfig.py
Last active August 31, 2023 03:53
A quickstart example with celery queue. #celery
# This is a quickstart! In the real world use a real broker (message queue)
# such as Redis or RabbitMQ !!
BROKER_URL = 'sqlalchemy+sqlite:///tasks.db'
CELERY_RESULT_BACKEND = "db+sqlite:///results.db"
CELERY_IMPORTS = ['tasks']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'