Skip to content

Instantly share code, notes, and snippets.

View jokull's full-sized avatar
☺️

Jökull Sólberg Auðunsson jokull

☺️
View GitHub Profile
@jokull
jokull / touch-develop.sh
Created April 1, 2023 16:21
Push current tip to remote `develop` branch
#!/bin/bash
# Function to check if the branch exists on the remote
branch_exists_on_remote() {
git ls-remote --quiet --exit-code origin "refs/heads/$1" &>/dev/null
return $?
}
# Function to check if the branch exists locally
branch_exists_locally() {
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable react-hooks/exhaustive-deps */
import { useRouter } from "next/router";
import { z } from "zod";
import requests
import re
from bs4 import BeautifulSoup
import random
URL = "http://www.ljod.is/index.php/ljod/poem_collection/author"
page = requests.get(URL)
soup = BeautifulSoup(page.content, "html.parser")
@jokull
jokull / graphs.R
Created October 26, 2020 14:42
hagstofan-rafhjol
# 87116010 = Lítil rafknúin ökutæki og hlaupahjól gerð fyrir aksturshraða < 25 km á klst (reiðhjól b og c, létt bifhjól 1)
# 87116090 = Létt bifhjól 2
# 87120000 = Reiðjól
# From january 2020
# 8711.6011 = reiðhjól b
# 8711.6012 = reiðhjól c
# 8711.6013 = létt bifhjól 1
library(scales)
import re
from typing import Dict, Iterable
from reynir import Greynir
from reynir.reynir import _Sentence
greynir = Greynir()
COMPANY_SUFFIXES = (
"ehf.",
"""
Look at the split of non-working-day windows for each year
Produces something like this:
2020 - 117 frídagar (119 í frígluggum sem hefjast á árinu)
- 1x fimm daga frí - 9.4 (Holy Thursday)
- 2x fjögurra daga frí - 24.12 (Christmas Eve), 31.12 (New Year's Eve)
- 3x þriggja daga frí - 1.5 (Labour Day), 3.5 (Whit Monday), 1.8 (Commerce Day)
- 47x tveggja daga frí
import os
from enum import Enum as PyEnum
from collections import namedtuple
from fastapi import Depends, FastAPI, HTTPException
from starlette.requests import Request
from starlette.templating import Jinja2Templates
from sqlalchemy import (
create_engine,
@jokull
jokull / Dockerfile
Created March 28, 2017 10:33
Python with texpdf binary
FROM python:2.7
MAINTAINER Solberg Audunsson <solberg@takumi.com>
# Install uWSGI
RUN pip install uwsgi pipenv
# Standard set up Nginx
ENV NGINX_VERSION 1.9.11-1~jessie
@jokull
jokull / fasteignir.py
Created February 20, 2017 09:24
Get notified when a new property listing on visir.is is discovered
import os
import json
import lxml.html
from lxml.cssselect import CSSSelector
import requests
cookies = {
'session_name': 'dpoiudav0gnu6e8uf2uklift63',
}
@jokull
jokull / .env
Created May 17, 2016 08:14
Find follower accounts that have profile pics with faces in them
OAUTH_CONSUMER_KEY=
OAUTH_CONSUMER_SECRET=
OAUTH_TOKEN=
OAUTH_TOKEN_SECRET=
IMGIX_TOKEN=