Skip to content

Instantly share code, notes, and snippets.

View ulfaslak's full-sized avatar
🐝
modeling modeling

Ulf Aslak ulfaslak

🐝
modeling modeling
View GitHub Profile
newpy () {
local lowercase_string="$(echo "$1" | tr '[:upper:]' '[:lower:]')" # Convert folder name to lowercase
local hyphenated_string="$(echo "$lowercase_string" | tr -c '[:alnum:]' '-')" # Convert non-alphanumeric characters to hyphens
local clean_string="$(echo "$hyphenated_string" | sed -e 's/^-*//' -e 's/-*$//')" # Remove leading and trailing hyphens
folder_name=$(date +%Y%m%d)-$clean_string # Prepend date, formatted like YYYYMMDD
mkdir -p <repository-where-i-want-my-adhoc-analysis-folders-to-reside>/$folder_name # Create folder
cd <repository-where-i-want-my-adhoc-analysis-folders-to-reside>/$folder_name # ... cd into it
virtualenv env # Create virtual env
source env/bin/activate # ... activate it
pip3 install -U flake8 black
@ulfaslak
ulfaslak / main.py
Created January 10, 2024 14:37
Sphinx Documentation Scraper
import requests as rq
import os
from bs4 import BeautifulSoup
from urllib.parse import urljoin
BASE_URL = "https://www.pymc.io/projects/docs/en/stable/"
# BASE_URL = "https://www.pymc.io/projects/examples/en/latest/"
PAGES_CRAWLED = 0
8950 4e47 0d0a 1a0a 0000 000d 4948 4452
0000 0168 0000 01ad 0806 0000 003b c0ee
d200 0001 6169 4343 506b 4347 436f 6c6f
7253 7061 6365 4469 7370 6c61 7950 3300
0028 9163 6060 5249 2c28 c861 6160 60c8
cd2b 290a 7277 5288 888c 5260 7fc8 c00e
84bc 0c62 0c0a 89c9 c505 8e01 013e 4025
0c30 1a15 7cbb c6c0 08a2 2feb 82cc 3a25
35b5 49b5 5ec0 d762 a6f0 d58b af44 9b30
d5a3 00ae 94d4 e264 20fd 0788 5393 0b8a
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can't make this file beautiful and searchable because it's too large.
source,target,datetime,id
13_Robespierre,24NYTdk,2019-05-06 14:32:32+00:00,1125408005078564865
13_Robespierre,AnneDanmark,2019-05-08 09:44:43+00:00,1126060349910859777
13_Robespierre,H38GE,2019-05-12 13:33:07+00:00,1127567381214183425
13_Robespierre,HappiSabi,2019-05-16 23:51:22+00:00,1129172519926337536
13_Robespierre,JalehTavakoli,2019-06-05 09:38:18+00:00,1136205595810381824
13_Robespierre,Kartoffelploven,2019-05-09 09:49:21+00:00,1126423906418610178
13_Robespierre,RasmusPaludan,2019-05-09 09:07:34+00:00,1126413390816133120
13_Robespierre,RasmusPaludan,2019-05-14 20:27:53+00:00,1128396535841075204
Twitter data around tweets with hashtags #fv19, #ft19 and #dkpol.
@ulfaslak
ulfaslak / .nbopen
Created January 9, 2019 08:50
nbopen minimal
function nbopen(){
# For this function to work, in .jupyter/jupyter_notebook_config.py, set `c.NotebookApp.notebook_dir = '/'` so notebook always launches from root
if [ $# -eq 0 ] ; then
if lsof -Pi :8888 -sTCP:LISTEN -t > /dev/null ; then
echo "A Jupyter Notebook is already open on port 8888"
else
jupyter notebook --port 8888
fi
else
if [ "${1:0:1}" != "/" ] ; then
{
"nodes": [
{"id": "Myriel", "group": 1, "size": 31},
{"id": "Napoleon", "group": 1, "size": 1},
{"id": "Mlle.Baptistine", "group": 1, "size": 17},
{"id": "Mme.Magloire", "group": 1, "size": 19},
{"id": "CountessdeLo", "group": 1, "size": 1},
{"id": "Geborand", "group": 1, "size": 1},
{"id": "Champtercier", "group": 1, "size": 1},
{"id": "Cravatte", "group": 1, "size": 1},