Skip to content

Instantly share code, notes, and snippets.

View nilsFK's full-sized avatar
🏠
Working from home

Nils F. Karlsson nilsFK

🏠
Working from home
View GitHub Profile
@nilsFK
nilsFK / stock_calculator.py
Created October 5, 2024 13:24
Stock percentage distribution
from typing import List, Dict
class AllocationError(Exception):
"""Custom exception for allocation errors."""
pass
def validate_parameters(
num_stocks: int,
factor: float,
last_stock_cap: float,
@nilsFK
nilsFK / bytbil-car-price-avg.js
Last active January 10, 2020 10:34
bytbil.com - get average car price (including VAT)
// bytbil.com - Get average car price (including VAT) for all cars on a given page with console.
var arr = $(".car-price-main").toArray().map((x) => parseInt(x.innerText.replace(/\s|kr/g, ''))); console.log(arr); (arr.reduce((a, b) => a + b, 0)) / arr.length;
@nilsFK
nilsFK / diff_freeze.py
Created March 14, 2019 10:53 — forked from qgerome/diff_freeze.py
How to compare or diff 2 pip freeze or 2 requirements.txt in Python
"""
pip install click
"""
import click
import itertools
# -*- coding: utf-8 -*-
"""
Flask-Login example
===================
This is a small application that provides a trivial demonstration of
Flask-Login, including remember me functionality.
:copyright: (C) 2011 by Matthew Frazier.
:license: MIT/X11, see LICENSE for more details.
"""
@nilsFK
nilsFK / Preferences.sublime-settings
Last active August 29, 2015 14:18
Sublime 3 user preferences
{
"bold_folder_labels": true,
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"default_line_ending" : "unix",
"font_options": "subpixel_antialias",
"font_size": 14,
"gutter" : true,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
@nilsFK
nilsFK / SublimeLinter.sublime-settings
Last active July 23, 2018 16:15
SublimeLinter settings for Sublime3+htmltidy+Angular
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Danish Royalty/Danish Royalty.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "load/save",
"linters": {
"htmltidy": {
@nilsFK
nilsFK / Git Aliases
Last active August 29, 2015 14:00
GIT aliases
[alias]
# Basic commands
ignored = git ls-files -v | grep \"^[[:lower:]]\"
st = status -s
stat = status
ci = commit
co = checkout
br = branch
brav = branch -av
unstage = reset HEAD --