Skip to content

Instantly share code, notes, and snippets.

View Ddedalus's full-sized avatar

Hubert Bereś Ddedalus

View GitHub Profile
@Ddedalus
Ddedalus / quiver.lua
Created April 16, 2021 09:43
Preview quiver diagrams in pandoc HTML and LaTeX
-- Install: save the file in $(pandoc data dir)/filters
-- pandoc --filter quiver.lua
-- call this filter before any cross-referencing filters like xnos or crossref
-- Markdown syntax:
-- :::{.quiver #eq:label}
-- <paste LateX Output from q.uiver.app <including the link>
-- :::
-- Reference with -@eq:label for just the number without eq. prefix.
@Ddedalus
Ddedalus / slides.css
Last active April 17, 2021 08:31
CSS to style HTML preview of slides written in pandoc
/*
1. Place this in
%USERPROFILE%\.vscode\extensions\shd101wyy.markdown-preview-enhanced-0.5.16\node_modules\@shd101wyy\mume\styles\preview_theme
2. Add to VSCode settings:
"markdown-preview-enhanced.previewTheme": "slides.css",
*/
/*!
Font definitions takes from:
* LaTeX.css (https://latex.now.sh/)
@Ddedalus
Ddedalus / bodyonly.html
Created February 5, 2021 20:17
Pandoc template for HTML body
<!--
1. Work out the data dir: pandoc --version
2. Put this file in the data directory: %APPDATA%/pandoc/templates
3. Add pandoc option: --template=bodyonly.html
4. Add YAML metadata to .md file: title, subtitle, date, author, toc, toc-title, include-beofre, include-after
-->
$for(include-before)$
$include-before$
$endfor$
@Ddedalus
Ddedalus / log_watcher.ps1
Created July 23, 2020 10:03
Watch your log file live in PowerShell
Get-Content .\log\your_log.log -Tail 0 -Wait
@Ddedalus
Ddedalus / powershell.ps1
Last active October 3, 2023 12:18
When you reinstall Windows...
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
iwr -useb get.scoop.sh | iex
scoop install aria2
scoop install git-with-openssh 7zip
scoop bucket add extras
scoop update
scoop install vscode windows-terminal
scoop install firefox googlechrome
@Ddedalus
Ddedalus / scrape_list.py
Created June 24, 2020 06:45
Capture scrapy crawler results to a Python list
import scrapy
from scrapy import signals
from scrapy.signalmanager import dispatcher
class MySpider(scrapy.Spider):
...
# gather the results, see: https://stackoverflow.com/a/40240712
nurseries = []
@Ddedalus
Ddedalus / type_clipboard.py
Created June 19, 2020 08:37
Type out the contents of the clipboard
"""
This script types the content of your clipboard.
# setup:
pip install pyautogui, pyperclip
# usage:
python ./type_clipboard.py
# notes:
@Ddedalus
Ddedalus / background_killer.py
Created May 13, 2020 11:06
Remove background from images of black text
# %%
import glob
import sys
import cv2
import numpy as np
# %%
def remove_background(frame):
@Ddedalus
Ddedalus / bot.py
Created December 10, 2019 20:45
VSCode Jupyter slowdown tester
'''
WARNING: This script emulates mouse and keyboard.
To abort the emulation, move your MOUSE to the TOP LEFT CORNER of the screen.
Usage:
1. Create an empty Python file and start the interactive window (let it load).
2. With mouse over the new file, use a keyboard shortcut to open a terminal and excute this file with python.
3. The script will remove all contents from your empty file and start
writing the same cell over and ove again and executing it with the
ctrl + enter shortcut.
@Ddedalus
Ddedalus / pre-commit
Last active December 9, 2019 20:13
Run black and flake8 before each commit. Error on flake8 error
#!/usr/bin/env sh
# Pre commit hook
# autoformat
black -q .
# lint
flake_out="$(flake8 .)"
flake_code=$?