Skip to content

Instantly share code, notes, and snippets.

View sivy's full-sized avatar

Steve Ivy sivy

View GitHub Profile
@sivy
sivy / resampler.py
Last active October 14, 2021 16:42
simple wrapper script around ffmpeg i use to resample audio files for deflemask
#!/bin/env python3
import argparse
import os
# this is 'ffmpeg-python', not 'ffmpeg' or 'python-ffmpeg' :D
import ffmpeg
from pathlib import Path
# one weird trick to remove the extra "encoder" metadata
# that ffmpeg adds and deflemask h8s
one_weird_trick = {
@sivy
sivy / letsencrpt-issue.yml
Created January 15, 2021 23:17
monkinetic letsencrypt-issue ansible playbook
---
- hosts: webservers
tasks:
- name: "Create required directories in /etc/letsencrypt"
file:
path: "/etc/letsencrypt/{{ item }}"
state: directory
owner: root
group: root
mode: u=rwx,g=x,o=x
# update was parsed from the goodreads xml as a big-ass dictionary/hashmap
name = update['actor']['name']
title = update['object']['read_status']['review']['book']['title']
author = update['object']['read_status']['review']['book']['author']['name']
status = update['object']['read_status']['status']
@sivy
sivy / aggregate_lookup_events_for_server.js
Last active March 26, 2018 21:11
Understanding Aggregations on MongoBD
// 1000 servers
// 1000000 events, randomly distributed across servers
db.getCollection("server").aggregate([
{ $match: { created_by: "sivy"}},
{ $lookup: {
from: "event",
let: { server_uuid: "$instance_uuid" },
pipeline: [
{ $match: {
module Jekyll
module Filters
module SignalLogFilters
def date_with_yc_year(date)
year = date.year
# puts year
yc_year = 105+(year-2003)
# puts yc_year
time(date).strftime("YC#{yc_year}.%m.%d")
try:
pass_through_moria()
except (UnexpectedBalrogError) as oh_shit_a_balrog:
print "FLY YOU FOOLS"
15-10-27 17:17:05 pce_cloud_provisioner [DEBUG:] Checking on Mount point /apps
15-10-27 17:17:05 pce_cloud_provisioner [INFO:] cmd_subprocess() - Executing df -k /apps; ls -l /apps
15-10-27 17:17:05 pce_cloud_provisioner [INFO:] df: `/apps': No such file or directory
15-10-27 17:17:05 pce_cloud_provisioner [INFO:] df: no file systems processed
15-10-27 17:17:05 pce_cloud_provisioner [INFO:] ls: cannot access /apps: No such file or directory
15-10-27 17:17:05 pce_cloud_provisioner [INFO:] cmd_subprocess() - returncode=2
15-10-27 17:17:05 pce_cloud_provisioner [DEBUG:] check_mount_point() - rc=2
15-10-27 17:17:05 pce_cloud_provisioner [INFO:] cmd_subprocess() - Executing grep mptspi /sys/class/scsi_host/host?/proc_name
15-10-27 17:17:05 pce_cloud_provisioner [INFO:] cmd_subprocess() - returncode=0
15-10-27 17:17:05 pce_cloud_provisioner [INFO:] format_mount_volume() - /sys/class/scsi_host/host2/proc_name:mptspi
def create_or_update(self, item_id, data):
if not self.validate(data):
raise ValidationError('Validation error!')
file_path = self._filepath(item_id)
existing_data = {}
try:
with open(file_path, 'r') as f:
content = f.read()
class Foo(object):
num = 1
ary = []
class Bar(Foo):
pass
Bar.num = 2
Bar.ary.extend([1])
[Fri Feb 06 14:29:06.602584 2015] [:error] tables.DataTableView.__init__(self, workflow.request)
[Fri Feb 06 14:29:06.602613 2015] [:error] File "/usr/lib/python2.7/dist-packages/horizon/tables/views.py", line 29, in __init__
[Fri Feb 06 14:29:06.602642 2015] [:error] super(MultiTableMixin, self).__init__(*args, **kwargs)
[Fri Feb 06 14:29:06.602670 2015] [:error] TypeError: __init__() takes exactly 1 argument (2 given)