Skip to content

Instantly share code, notes, and snippets.

View BillMoriarty's full-sized avatar

Bill Moriarty BillMoriarty

View GitHub Profile
@BillMoriarty
BillMoriarty / bandcamp_to_markdown.js
Last active August 18, 2023 17:27
This script generates markdown files for Bandcamp albums. It takes an array of Bandcamp URLs and an output folder as input. For each URL, the script extracts the album name, artist name, and album ID from the Bandcamp page. It then generates a markdown file with an embedded Bandcamp player for the album. The markdown file is named after the arti…
const fs = require('fs');
const https = require('https');
const path = require('path');
// replace below folder you want to save this to
const outputFolder = '/path/to/local/folder/';
// add Bandcamp URLs here - here is an example url that will take you to a great album, by the way
// note - Bill did not work on Fourtet - he just likes this music
const bandcampUrls = [
@BillMoriarty
BillMoriarty / mpi-matrix-multiplication.c
Last active October 30, 2017 18:34
A C project for Temple University to multiply two square matrices ("matrix1.txt" and "matrix2.txt") using the MPI protocol and write to "resulting-matrix.txt"
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#define min(x, y) ((x)<(y)?(x):(y))
//code altered by Bill Moriarty for Temple University
@BillMoriarty
BillMoriarty / ispower.java
Last active November 1, 2017 00:09
quick algo I wrote for Temple class to determine if a number is a power (if it can be written as q to the k)
public class MyClass {
public static void main(String args[]) {
int N=125;
int q=2;
double k=Math.floor( Math.log(N) );
System.out.println("k is " + k);
@BillMoriarty
BillMoriarty / file in and out name.c
Last active October 20, 2016 14:09
C command line: get string for file input name, get string for file name output
/* Hi all - I am currently a student. The code below was developed during student projects. It may not be the most efficient or robust.
Use it if it's helpful for you.
-Bill Moriarty
*/
#include <stdio.h>
#define BUF_SIZE 64
/* get the user's input and output filename from the keyboard */
char inKey[BUF_SIZE];
@BillMoriarty
BillMoriarty / remove_trailing_space.c
Last active October 20, 2016 14:11
function that we wrote in class last week to remove the trailing new line character from the filename(which is found by isspace)
/* Hi all - I am currently a student. The code below was developed during student projects. It may not be the most efficient or robust.
Use it if it's helpful for you.
-Bill Moriarty
*/
/* written by J. Fiore for 2107 class* /
/*
For the "C" locale, white-space characters are any of:
' ' (0x20) space (SPC)
'\t' (0x09) horizontal tab (TAB)