Skip to content

Instantly share code, notes, and snippets.

View marksweiss's full-sized avatar

Mark S. Weiss marksweiss

  • Brooklyn, NY
View GitHub Profile
@marksweiss
marksweiss / logicprox-stdlib.js
Created November 19, 2023 07:22
Core APIs, documentation and helper functions for LogicProX MIDI scripting
// Define NeedsTimingInfo as true at the global scope to enable GetTimingInfo()
var NeedsTimingInfo = true;
///////////////////////
// ProcessMIDI Functions
// NOTE: ProcessMIDI() can be used as the main event loop in an application.
// It will be called repeatedly and events will be generated according to the TiminInfo
/*
@marksweiss
marksweiss / # mit-scheme - 2022-12-22_00-32-52.txt
Created December 22, 2022 05:36
mit-scheme on macOS 12 - Homebrew build logs
Homebrew build logs for mit-scheme on macOS 12
Build date: 2022-12-22 00:32:52
@marksweiss
marksweiss / config.py
Last active September 3, 2017 00:41 — forked from vadviktor/config.py
ptpython config
"""
Configuration example for ``ptpython``.
Copy this file to ~/.ptpython/config.py
"""
from __future__ import unicode_literals
from prompt_toolkit.filters import ViInsertMode
from prompt_toolkit.key_binding.input_processor import KeyPress
from prompt_toolkit.keys import Keys
from pygments.token import Token
@marksweiss
marksweiss / gist:b2d6f73abe818d56b5fd
Last active August 29, 2015 14:05
Get Postgres and psycopg2 to work on OSX Mavericks 10.9.4
-- 1) Install Postgres.app, seriously (Before doing this I was wrestling with a socket error connecting to the DB that many people have on StackOverflow etc. but multiple remedies didn't work. Feel free to waste time on this but I stopped wasting time on it this way.)
-- 2) Append path to Postgres.app bin directory to end of $PATH in .bash_profile
-- 3) At this point running py scripts that include psycopg2 will work, but import
-- in the (Anaconda, (YMMV with other Py shells)) Python shell will not, so ...
-- 4) $ sudo ln -s /Applications/Postgres.app/Contents/Versions/9.3/lib/libssl.1.0.0.dylib /opt/local/lib/libssl.1.0.0.dylib
-- 5) $ sudo ln -s /Applications/Postgres.app/Contents/Versions/9.3/lib/libcrypto.1.0.0.dylib /opt/local/lib/libcrypto.1.0.0.dylib
-- (Anaconda, (YMMV with other Py shells)) Psycopg2 in Python shell can't find and link to these dylibs that
-- are part of Postgres distro unless there are sym links in the fs under the same user
-- that launches the Python shell
-- 6) Use the defaul
@marksweiss
marksweiss / ValidateJSON
Created July 31, 2013 17:57
Minimal Python script to validate JSON. Just uses standard library 'json' loads one ore files and catches and reports the first exception thrown in attempting to load and parse each file. Takes one argument a path to the files to validate. The script will glob* that path and attempt to load and parse as JSON all files found there.
#!/usr/bin/python
from glob import glob
import json
import sys
def main(path):
files = glob(path)
for file in files:
#!/bin/bash
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /var/db/receipts/com.mysql.*
sudo rm /etc/my.conf
sudo vi /etc/hostconfig # (Remove line MYSQLCOM=-YES)
sudo rm -rf /Library/Reciepts/mysql*
sudo rm -rf /Library/Reciepts/MySQL*
#include <stdio.h>
/* Introduction
Code for "Beautiful Code" Chapter 10, "The Quest for an Accelerated
Population Count" by Henry Warren.
The function pop*() counts the number of 1 bits in a word
Used in set operations represented as bit arrays (e.g. DB bit indexes)
among other uses discussed in the book.
This code just makes working versions of the examples, so one can step
# Convert a line of a block to textile
def make_textile(line)
j = 0
prefix = ''
while line[j] == 32
prefix.concat "&nbsp;"
j += 1
end
line = line.strip
if line.length > 0