docs/conf.py
import importlib
import inspect
import os
import sys
from dataclasses import dataclass | |
class Validations: | |
def __setattr__(self, prop, val): | |
if (validator := getattr(self, f"validate_{prop}", None)): | |
object.__setattr__(self, prop, validator(val) or val) | |
else: | |
super().__setattr__(prop, val) |
FROM python:3.7 | |
ENV PYTHONUNBUFFERED 1 | |
WORKDIR /code | |
# Copying the requirements, this is needed because at this point the volume isn't mounted yet | |
COPY requirements.txt /code/ | |
# Installing requirements, if you don't use this, you should. | |
# More info: https://pip.pypa.io/en/stable/user_guide/ |
# https://hakibenita.com/fast-load-data-python-postgresql | |
from typing import Iterator, Dict, Any, Optional | |
from urllib.parse import urlencode | |
import datetime | |
#------------------------ Profile | |
import time |
// ==UserScript== | |
// @name Jureeka | |
// @namespace http://www.jureeka.org | |
// @description Turns legal citations in webpages into hyperlinks that direct you to online legal source material. | |
// ==/UserScript== | |
// $Id: jureeka.js 1256 2012-02-13 19:06:16Z imad $ | |
/* | |
Warnings: |
# venv_wrapper, manage all virtual environments under ~/.venv/ | |
# Include following in .bashrc / .bash_profile / .zshrc | |
# See https://gist.github.com/dbtek/fb2ddccb18f0cf63a654ea2cc94c8f19 | |
# Usage | |
# $ mkvenv myvirtualenv # creates venv under ~/.venv/ | |
# $ venv myvirtualenv # activates venv | |
# $ deactivate # deactivates venv | |
# $ rmvenv myvirtualenv # removes venv | |
export VENV_HOME="$HOME/.venv" |
# An example to get the remaining rate limit using the Github GraphQL API. | |
import requests | |
headers = {"Authorization": "Bearer YOUR API KEY"} | |
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section. | |
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers) | |
if request.status_code == 200: |
import nltk | |
from nltk.tokenize.treebank import TreebankWordTokenizer | |
class TreebankSpanTokenizer(TreebankWordTokenizer): | |
def __init__(self): | |
self._word_tokenizer = TreebankWordTokenizer() | |
def span_tokenize(self, text): |
# Get a person's name, location, summary, # of connections, and skills & endorsements from LinkedIn | |
# URL of the LinkedIn page | |
user_url <- "https://www.linkedin.com/in/daattali" | |
# since the information isn't available without being logged in, the web | |
# scraper needs to log in. Provide your LinkedIn user/pw here (this isn't stored | |
# anywhere as you can see, it's just used to log in during the scrape session) | |
username <- "yourusername" | |
password <- "yourpassword" |