Skip to content

Instantly share code, notes, and snippets.

@jduckles
jduckles / frigate_notification.yaml
Created April 16, 2022 03:21 — forked from hunterjm/frigate_notification.yaml
Frigate Notification Blueprint
blueprint:
name: Frigate Notification
description: |
## Frigate Mobile App Notification
This blueprint will send a notification to your device when a Frigate event for the selected camera is fired. The notification will initially include the thumbnail of the detection, but will update to include actionable notifications allowing you to view the saved clip/snapshot when available, or silence the notification for a configurable amount of time.
With this blueprint, you may send the notification to multiple devices by leaving "Device" blank and instead use a [notification group][1].
### Required entities:
#!/bin/bash
# Make a PDF look scanned.
# Extracted from https://github.com/baicunko/scanyourpdf and modified for smaller output files (compression lower density).
INPUT_FILE=$1
/usr/local/bin/convert -density '80' ${INPUT_FILE} -colorspace 'gray' -linear-stretch '3.5%x10%' \
-blur '0x0.5' -attenuate '0.25' +noise Gaussian -rotate 0.5 \
-compress lzw -quality 50 scanned_${INPUT_FILE}
@jduckles
jduckles / textexpander.sh
Last active June 27, 2024 13:14
Takes a URL and grabs the <title></title> contents to provide a Markdown Link using the title of the page. Used as a TextExpander Shortcut to paste links into Markdown Files with the page title as the link text.
#! /bin/bash
# Python Script to pull down title of web page and enter it into a markdown snippet.
~/bin/url2mdlink.py %clipboard
@jduckles
jduckles / Example_bash_loop.sh
Last active June 27, 2024 13:14
This is how we can use loops to iterate over a list of items.
#!/bin/bash
for i in $(cat list_of_items.txt); do
# This echoes out each item
echo $i;
done
@jduckles
jduckles / DC_website
Created August 6, 2019 23:06
Community posts in DC blog
# The website is itself a Git repo
git clone https://github.com/datacarpentry/datacarpentry.github.io
# enter the directory after we clone the repo
cd datacarpentry.github.io
# enter the directory where posts are, posts are text in Markdown
cd _posts
# Lets look (using grep) for the line in all posts that contains the "Subheadline"
# subheadline seems to be used to flag posts including community elements
grep -r "subheadline:" * |grep -i community
# grep -r looks recursively through directories, and grep -i makes the match case-insensitive (ie. community = CommunIty)
library(tidyverse)
library(jsonlite)
# Look for manifest in bucket "example-public-bucket"
data_manifest <- as_tibble(fromJSON("https://abacusworkflows.blob.core.windows.net/example-public-bucket/manifest.json"))
# Select down from manifest to just records with shortname "nz_stats_livestock"
livestock_record <- data_manifest %>% filter(shortname == "nz_stats_livestock")
# Open first file of nz_stats_livestock record
livestock_data <- read_csv(livestock_record$files[[1]])
# Cleanup dates
livestock_data <- livestock_data %>% mutate(Year = as.numeric(str_remove_all(Year, "As at June 30 ")))
#!/usr/bin/python
from struct import pack, unpack #Some unpacking for the WAV encoding
from FFT import * #Some FFT goodness
from Numeric import * #Gotta have speedy math
import wave #For opening WAV files
from pylab import * #For ploting
from matplotlib.widgets import Slider, Button, RadioButtons
import os
from time import time
@jduckles
jduckles / lapply_example.R
Last active August 22, 2018 03:33
A simple example of lapply
mydata1 <- data.frame(letter = c("a","b","c","a","b","c"))
mydata2 <- data.frame(letter = c("a","b","c","a","b","c","a","b","a"))
stuff <- list(mydata1,mydata2)
myawesome <- function(df) {
levels <- c("a","b","c")
as.factor(df$letter)
}
/article/27339/download/xml/
/article/26369/download/xml/
/article/25437/download/xml/
/article/26922/download/xml/
/article/26860/download/xml/
/article/26516/download/xml/
/article/26323/download/xml/
/article/26304/download/xml/
/article/26262/download/xml/
/article/26235/download/xml/
library(tidyverse)
library(readr)
workshops <- read_csv('workshops.csv')
svg('workshops.svg')
ggplot(workshops, aes(x=date,y=workshops$count)) + geom_line() + ylab("Cumulative Number of Workshops")
dev.off()
instructors <- read_csv("instructors.csv")
svg('instructors.svg')