Skip to content

Instantly share code, notes, and snippets.

@Japanuspus
Japanuspus / sage plots in jupyter with standard ipython kernel.ipynb
Created August 3, 2023 09:56
Sage plots in jupyter notebooks with standard ipython kernel
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Japanuspus
Japanuspus / main.rs
Created October 14, 2021 06:59
Cross-platform global hotkey in Rust
use tauri_hotkey as hotkey; // Discontinued, but v0.1.2 is working fine as of 2021-10-14
use std::io::{stdin, Read};
fn main() {
let spec = "ctrl+alt+r";
let mut hk = hotkey::HotkeyManager::new();
let key = hotkey::parse_hotkey(&spec).unwrap();
println!("Listening for {}. Enter to exit", &spec);
hk.register(key, move || println!("{} pressed!", &spec)).unwrap();
stdin().read(&mut [0]).unwrap(); // wait for "enter"
@Japanuspus
Japanuspus / note_cleaner.py
Created August 28, 2021 20:20
note_cleaner: remove duplicate titles inside notes as added by repeated nvpy/resoph/nvalt migrations
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):
'
' 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
<html>
<head>
<title>Labyrinten</title>
</head>
<body>
<script>
function dragstart_handler(ev) {
ev.dataTransfer.setData("text/plain", ev.target.id);
}
function dragover_handler(ev) {
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 August 13, 2020 05:11
Solving a nonogram
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 July 10, 2020 06:26
Heterogeneous dispatch with numba can be fast
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 July 8, 2020 04:31
Performance of np.array for parsing list of strings
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 12:45
Example of python CLI application using the device-code flow to authorize against login.microsoft.com
import requests
import json
from pathlib import Path
import time
import subprocess
import re
from datetime import datetime
import logging
import argparse