Skip to content

Instantly share code, notes, and snippets.

@Kopachris
Kopachris / test_midi_cb.py
Created August 28, 2022 03:48
Test MIDI clipboard
# Test MIDI clipboard -- licensed WTFPL
import win32clipboard as cb
import win32con as con
import music21 as music
def TestClipboardEnum():
cf_names = {v: k for k, v in con.__dict__.items() if k[:3] == 'CF_' and k != 'CF_SCREENFONTS'}
cb.OpenClipboard()
@Kopachris
Kopachris / volume.py
Created August 17, 2022 04:23
Use replaygain tags for peak normalization to -2.50 dBFS
import numpy as np
import mutagen
import sys
import os.path
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3
from mutagen.id3 import ID3, TXXX, RVA2
from numpy import log10 as log
from subprocess import Popen, PIPE
from pathlib import Path
//Copyright (C) 2007 by Christopher Koch
//Released under the WTF Public License
#include <iostream>
using namespace std;
int main()
{
//initialize variables
int month,day,hour,minute,monthsum,year,century;
with Z as (
select sum(ord.tot_sls_amt) as Total, ord.cus_no
from oehdrhst_sql ord
where ('12/9/19' >= ord.posted_dt and ord.posted_dt >= '1/1/2019')
group by ord.cus_no
)
select
c.SalesPersonNumber as [Sales Person],
c.AccountTypeCode as [Customer Type],
c.Discount as [Discount],
@Kopachris
Kopachris / regexsub.py
Created January 5, 2017 07:45
BotenAlfred module for sed-like substitutions in IRC
#!/usr/bin/env python
# coding: utf8
from gluon import *
import bot_utils
import re
from multiprocessing import Process, Pipe
from time import sleep, time
from random import choice
## Description stored in db.bot_modules
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
## Begin license block ##
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
## Version 2, December 2004
##
## Copyright (C) 2013 Christopher Koch <kopachris@gmail.com>
##
@Kopachris
Kopachris / jcm.py
Last active July 14, 2024 06:36
Module for interfacing with JCM bill validators
#!/usr/bin/env python3.5
"""
This module provides classes for interfacing with and retrieving
acceptance statistics from JCM bill validators.
Basic usage:
>>> bv = try_get_model()
>>> bv.connect()
from gluon import *
import bot_utils
import urllib2
import json
from datetime import datetime
import dateutil.parser
description = "Retrieves weather from wunderground.com. Set your WeatherUnderground API key by PMing the bot '<prefix>apikey <your-api-key>' or manually setting the wu_apikey variable."
prefix = "wu_"
from gluon import *
import bot_utils
import urllib2
from bs4 import BeautifulSoup
from bs4.diagnose import diagnose
import traceback
import re, string #for removing non-alphanumeric characters for comparing titles to the url
## Description stored in db.bot_modules
description = "URL resolver"
from gluon import *
import bot_utils
import random
import re
description = "!roll xdy - roll x number of y-sided dice"
prefix = "dice_"
event_type = 'PRIVMSG'