Skip to content

Instantly share code, notes, and snippets.

option = get_option('gallium-drivers')
gallium_drivers = []
foreach driver in option:
if driver == 'auto':
...
else:
gallium_drivers += driver
endif
endforeach
@dnicolodi
dnicolodi / smart.py
Last active December 24, 2021 20:11
import click
import decimal
from beancount.core import data
from beancount import loader
from beancount.parser import parser
from beangadgets import printer
from sklearn.feature_extraction.text import TfidfVectorizer, TfidfTransformer, CountVectorizer
from sklearn.svm import LinearSVC
class EntryPrinter(printer.EntryPrinter):
def __init__(self, currency_column=50):
super().__init__()
self.target_currency_column = currency_column
def Transaction(self, entry, oss):
# Compute the string for the payee and narration line.
strings = []
if entry.payee:
strings.append('"{}"'.format(misc_utils.escape_string(entry.payee)))
import click
@click.command()
@click.option('--verbose', '-v', type=int, count=True)
def main(verbose):
print(verbose)
# add an option
click.option('--times', '-n', type=int)(main)
import petl
import decimal
from beancount.core import data
NUMERIC = [int, float, decimal.Decimal, data.Amount]
def render(table, colsep=' ', narrow=True, numeric=None):
class Duration(timedelta):
def __new__(cls, value):
if isinstance(value, timedelta):
return cls(value.total_seconds())
return super(Duration, cls).__new__(cls, seconds=value)
@classmethod
def parse(cls, s):
sign = 1
if s[0] == '-':
<?php
$CONFIG = array (
'mail_domain' => '@mailDomain@',
'mail_smtpmode' => 'sendmail',
'datadirectory' => '@dataDir@',
'apps_paths' =>
array (
0 =>
array (
'path' => '@apps2Dir@',
(defun ledger-move-transaction-up ()
(interactive)
(save-excursion
(let* ((ext-A (ledger-navigate-find-element-extents (point)))
(prev (ledger-navigate-prev-xact-or-directive))
(ext-B (ledger-navigate-find-element-extents (point)))
(start-A (car ext-A))
(end-A (cadr ext-A))
(start-B (car ext-B))
(end-B (cadr ext-B))