Skip to content

Instantly share code, notes, and snippets.

// Code sample demonstrating use of Rust-style Result for an API Service in Angular + Typescript
// Posted: 2023-07-24
// Paul Barton
// Released to the public domain
import { Injectable } from '@angular/core';
import { environment } from '../environments/environment';
import {
HttpClient,
HttpErrorResponse,
@SavinaRoja
SavinaRoja / mydyndns.py
Last active December 29, 2018 22:59
A Selenium based script to automate dynamic dns
#!/usr/bin/env python
"""
A little script to automatically update my 'home' subdomain on A2 Hosting. No API
access so I implemented it with Selenium. Very simple now, might become more elaborate
later is needed.
"""
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
@SavinaRoja
SavinaRoja / serial_executor_test.py
Created September 3, 2018 13:58
A demonstration of how a Queue can be used to sync requests over serial
import asyncio
import functools
class Router(object):
def __init__(self, n):
self.serial_queue = asyncio.Queue()
self.n = n
async def serial_executor(self):
count = 0
#!/usr/bin/env python3
import os
#Bandcamp filenames look like "<ARTIST> - <ALBUM> - ## TRACKNAME.flac"
old_names = [fn for fn in os.listdir('.') if os.path.splitext(fn)[1] == '.flac']
new_names = []
for name in old_names:
new_name = name.split(' - ', 2)[2]
#!/bin/bash
#Steps:
# sudo apt-get install libomxil-bellagio-dev
# install some other stuff, here's at least a partial list
# sudo apt-get install libopus-dev libvorbis-dev libx264-dev libx265-dev
# libtheora-dev libvpx-dev libzvbi-dev libmp3lame-dev libass-dev
#
# git clone https://github.com/FFmpeg/FFmpeg.git
# cd FFmpeg
@SavinaRoja
SavinaRoja / capture.py
Last active July 16, 2018 23:46
Scripts for acquisition of video on Raspberry Pi with transmssion to remote server via sshfs
#!/usr/bin/env python3
"""
capture.py - A script to capture video and manage transfer of video data
Still in early stages of development and rapidly evolving to meet our needs. It
is partly a wrapper for raspivid, which it deploys.
Usage:
capture.py [options]
@SavinaRoja
SavinaRoja / PDF_rand.py
Created March 23, 2018 11:13
Generate random values per a probability density function.
import random
import matplotlib.pyplot as plt
a = 0 # Window minimum in x
b = 2 # Window maximum in x
c = 4 # Window maximum in y
my_df = lambda x : x ** 2
def rejection(f, x, y):
#!/usr/bin/env python
"""
Dashify
Usage:
dashify <input> [options] <output-dir>
dashify (-h | --help)
dashify --version
@SavinaRoja
SavinaRoja / hyper_concat.py
Last active September 5, 2017 01:55
Utilizing hyperarc representation for ffmpeg filtergraphs
#!/usr/bin/env python3
"""
Concat - a tool for efficiently concatenating video inputs and combining with
an audio file
Usage:
concat <json-input> [options] <output>
concat (-h | --help)
concat --version
@SavinaRoja
SavinaRoja / concat.py
Last active August 31, 2017 12:48
Some updates to Sebastien Charlemagne's code for flexibility and maintainability
#!/usr/bin/env python3
"""
Concat - a tool for efficiently concatenating video inputs and combining with
an audio file
Usage:
concat <json-input> [options] <output>
concat (-h | --help)
concat --version