Skip to content

Instantly share code, notes, and snippets.

View scottcowan's full-sized avatar

Scott Cowan scottcowan

View GitHub Profile
#!/usr/bin/env python3
"""
Extract magnet link from audiobookbay.lu pages.
Usage:
python3 extract-magnet.py <url>
python3 extract-magnet.py "https://audiobookbay.lu/abss/dungeonj-crawler-carl-book-2-carls-doomsday-scenario-matt-dinniman/"
Or make it executable:
chmod +x extract-magnet.py
@scottcowan
scottcowan / get_terraform_output.py
Created July 8, 2024 10:54
Get output from terraform state
import json
import sys
def get_terraform_output(state_file_path, output_name):
with open(state_file_path, 'r') as f:
state = json.load(f)
outputs = state.get('outputs', {})
output_value = outputs.get(output_name, {}).get('value', None)
@scottcowan
scottcowan / Cluster.md
Last active May 30, 2018 21:11
personal kubernetes
@scottcowan
scottcowan / watcher.curl
Created January 22, 2018 13:15
logstash email watcher
curl -XPUT "https://10.0.2.15:9200/_xpack/watcher/watch/fat-apps-errors-prod" -d'
{
"trigger": {
"schedule": {
"daily": {
"at": [
"07:00"
]
}
}
@scottcowan
scottcowan / setup.cmd
Created June 1, 2017 07:32
GPG windows
git config --global gpg.program "C:/Program Files (x86)/GNU/GnuPG/pub/gpg2.exe"
@scottcowan
scottcowan / package.ps1
Created February 8, 2017 14:17
unzipping Azure Cloud service
function ZipFiles( $zipfilename, $sourcedir )
{
Add-Type -Assembly System.IO.Compression.FileSystem
Add-Type -Assembly System.IO.Compression
$archive = [System.IO.Compression.ZipFile]::Open($zipfilename, [System.IO.Compression.ZipArchiveMode]::Create);
try
{
$files = [System.IO.Directory]::GetFiles($sourceDir, "*.*", [System.IO.SearchOption]::AllDirectories)
@scottcowan
scottcowan / magnet.go
Last active January 11, 2017 16:22
Add a torrent link to an rss feed file
package main
import (
"fmt"
"os"
"strings"
)
func main() {
fmt.Println(os.Args[1])
@scottcowan
scottcowan / NestedContainers.cs
Created December 8, 2016 17:01
change your logger for an instance and it's children
using System;
using StructureMap;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var container = new Container(_ =>