Skip to content

Instantly share code, notes, and snippets.

@duggan
duggan / setup.py
Created March 29, 2024 12:07
OpenVoice updated setup.py for running on Apple Silicon with Python 3.11
from setuptools import setup
setup(name='MyShell-OpenVoice',
version='0.0.0',
description='Instant voice cloning by MyShell.',
long_description=open('README.md').read().strip(),
long_description_content_type='text/markdown',
keywords=[
'text-to-speech',
'tts',
@duggan
duggan / Code.gs
Created March 6, 2021 15:03
Google Apps Script to check whether a HTTP endpoint is available, send a notification to an email address, and silence after three consecutive mails. A notification is also sent when the service becomes available again.
var properties = PropertiesService.getScriptProperties();
var service = "MyService"
var url = "http://example.com";
var email = "you@gmail.com";
function parseDate(date_string) {
return new Date(Date.parse(date_string)).toISOString();
}
@duggan
duggan / hacker.py
Created May 23, 2019 11:26
Hacker Sangiovese 2018
#!/usr/bin/env python3
import binascii
content = ''
with open('hacker.txt') as f:
content = f.read().splitlines()
line = ''.join(content)
n = 8
lines = [line[i:i+n] for i in range(0, len(line), n)]
@duggan
duggan / glow.ino
Created October 20, 2017 13:12
Arduino. Fading an LED in and out to produce a glow effect via the PWM pins.
/* Fading an LED in and out to produce a glow effect
via the PWM pins.
*/
int timer = 10;
int pin = 3;
int val = 0;
void setup(){
pinMode(pin, OUTPUT);
@duggan
duggan / controller.py
Created October 19, 2017 18:36
Radio Gate Controller
import signal
import time
import logging
import RPi.GPIO as GPIO
from collections import deque
from threading import Thread, Lock, Event
from twilio.rest import Client
from blink1_pyusb import Blink1
DRY_RUN = True
@duggan
duggan / configure.sh
Created February 3, 2017 16:13
A shell script for configuring Mesos/Storm via environment variables in Docker
#!/usr/bin/env bash
#
# Write a Storm configuration from environment variables.
#
# Environment variables namespaced with `MESOS_STORM_`
set -o errexit
set -o nounset
@duggan
duggan / pre-commit
Last active December 19, 2016 15:32 — forked from hartfordfive/pre-commit
Git pre-commit hook to validate JSON files
#!/bin/bash
# Comments:
# 1. You must add execution rights to this file (chmod u+x pre-commit)
# 2. You need to have the 'jq' package installed to parse the json
if [ "$(command -v jq )" == "" ] ; then
echo "jq required for pre-commit hook $0"
exit 1
fi
files:
"/tmp/barricade.sh" :
mode: "000700"
owner: root
group: root
source: <Your Barricade install.sh URL>
"/opt/elasticbeanstalk/tasks/taillogs.d/barricade.conf" :
mode: "000755"
owner: root
@duggan
duggan / Podcache.md
Last active December 22, 2015 17:47
Back up podcasts with metadata from a feed URL. Progress indicator and resuming.

Podcache

Back up podcasts with metadata from a feed URL. Progress indicator and resuming. Hacky, only really tested against FeedBurner/libsyn feeds.

When you run it, you get a directory named after the podcast with a list of mp3 files and metadata.json files.

tree /mnt/backups/podcast/
/mnt/backups/podcast/
@duggan
duggan / inventory.py
Created October 12, 2015 15:01
Present Terraform tfstate data as an Ansible inventory
#!/usr/bin/env python
import sys
import os
import json
import argparse
import collections
__description__ = """Ansible Dynamic Inventory for Terraform."""
__epilog__ = """