Skip to content

Instantly share code, notes, and snippets.

@reagle
reagle / markdown-zim-to-obsidian.py
Last active September 24, 2023 15:12
Convert Zim exported markdown to Obsidian by removing first heading and converting setext to atx headers
#!/usr/bin/env python3
"""Convert Zim exported markdown to Obsidian by:
1. removing first heading
2. converting setext to atx headers
"""
# https://gist.github.com/reagle/7418f54fb6e40fe8d925e1c3f5325076
import re
from pathlib import Path
@T3sT3ro
T3sT3ro / .bashrc.profiler
Created September 18, 2022 21:16
bash profiling utility - use it as a custom rcfile to get accurate timings for the whole .bashrc loading process
# Based on https://stackoverflow.com/a/20855353/5555799
# Store this file in ~/.bashrc.profiler and add this alias to your .bashrc:
# alias profilebashstartup='exec bash --rcfile ~/.bashrc.profiler'
TRACEFILE=$(mktemp /tmp/trace.XXX)
TIMINGFILE=$(mktemp /tmp/timing.XXX)
STARTTIME=$(date +%s.%N)
exec 3>&2 2> >( tee $TRACEFILE | sed -u 's/^.*$/now/' | date -f - +%s.%N >$TIMINGFILE)
set -x
@kepano
kepano / obsidian-web-clipper.js
Last active April 25, 2024 05:19
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
#!/usr/bin/env bash
set -e
DEVICE_NUMBER="9"
DEVICE_FILE="/dev/video${DEVICE_NUMBER}"
RTSP_URL="rtsp://username:password@WIFIFCAM:554"
# GitHub: iddo
# https://github.com/umlaeute/v4l2loopback/issues/109#issuecomment-617638198
@saisasidhar
saisasidhar / eos_as_videofeed.md
Created December 1, 2020 15:32
Canon EOS as video feed in Arch Linux
➜ uname -r
# get installed kernel version
➜ pacman -S linux-headers
# select kernel version
@atika
atika / pushover
Last active October 20, 2023 19:37
Send a pushover notification from Bash
#!/bin/bash
# ./pushover.sh -t "Pushover via Bash" -m "Pushover message sent with bash from $(hostname -f)" -p1 -s siren -u http://www.google.com -n "Google"
USER_TOKEN=YOUR_USER_TOKEN_HERE
# YOUR APPS TOKENS / UPPERCASE NAME WITH _TOKEN (usage: "-a monitor" uses MONITOR_TOKEN)
MONITOR_TOKEN=APP_TOKEN
BACKUP_TOKEN=APP_TOKEN
ALERT_TOKEN=APP_TOKEN
APP_LIST="monitor, backup, alert" # FOR USAGE
@mateuszwenus
mateuszwenus / save_restore_dependencies.sql
Last active April 11, 2024 05:49
PostgreSQL: How to handle table and view dependencies
create table deps_saved_ddl
(
deps_id serial primary key,
deps_view_schema varchar(255),
deps_view_name varchar(255),
deps_ddl_to_run text
);
create or replace function deps_save_and_drop_dependencies(p_view_schema varchar, p_view_name varchar) returns void as
$$
@wandernauta
wandernauta / sp
Last active April 16, 2024 15:37
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@colindean
colindean / pyuvcdyncrtl.py
Created December 7, 2011 01:40
UVC Pan/Tilt control program for GTK in Python
#!/usr/bin/env python
########################################################
# Created by: Steve Cundy
# Date Modified: Jan 29, 2008
#
# Purpose: quick and dirty gui to control PTZ of my
# Logitech Quickcam Orbit AF (actually there is no zoom
# control :)
#
# To Do: