Skip to content

Instantly share code, notes, and snippets.

@Japanuspus
Japanuspus / note_cleaner.py
Created Aug 28, 2021
note_cleaner: remove duplicate titles inside notes as added by repeated nvpy/resoph/nvalt migrations
View note_cleaner.py
from pathlib import Path
import re, sys, os
def clean_note_lines(title: str, lines: list[str]):
"""
Remove any lines matching title
"""
nn = re.compile(r"[^a-zA-Z0-9]")
def norm(s):
View gist:dd69437a419577a71406aee2fda0fda1
'
' Reply To All in Plain Text, with Linux-style quoting
'
' This allows you to use Outlook to reply to a mailinglist
'
' Copyright 2009 Matthijs van de Water
'
Sub ReplyAllPlain()
Dim app As New Outlook.Application
View 2021-01-12 minimal drag and drop.html
<html>
<head>
<title>Labyrinten</title>
</head>
<body>
<script>
function dragstart_handler(ev) {
ev.dataTransfer.setData("text/plain", ev.target.id);
}
function dragover_handler(ev) {
View mooring.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Japanuspus
Japanuspus / passion.ipynb
Created Aug 13, 2020
Solving a nonogram
View passion.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Japanuspus
Japanuspus / numba jitclasses.ipynb
Created Jul 10, 2020
Heterogeneous dispatch with numba can be fast
View numba jitclasses.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Japanuspus
Japanuspus / float_string_performance.ipynb
Last active Jul 8, 2020
Performance of np.array for parsing list of strings
View float_string_performance.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Japanuspus
Japanuspus / device_flow.py
Created May 25, 2020
Example of python CLI application using the device-code flow to authorize against login.microsoft.com
View device_flow.py
import requests
import json
from pathlib import Path
import time
import subprocess
import re
from datetime import datetime
import logging
import argparse
@Japanuspus
Japanuspus / main.rs
Created Dec 4, 2019
Create iterator that returns lenghts of runs of identical elements of slice
View main.rs
use std::iter;
fn run_lengths<'a, T>(a: &'a[T]) -> impl Iterator<Item=usize> + 'a
where
T: std::cmp::PartialEq
{
a
.windows(2)
.enumerate()
.filter_map(|(i, ab)| if ab[0]==ab[1] {None} else {Some(i as isize)})
@Japanuspus
Japanuspus / volumiosetup.sh
Created Apr 25, 2015
Shell script for Volumio config
View volumiosetup.sh
echo 'Doing stuff'