Skip to content

Instantly share code, notes, and snippets.

#required libraries
import urllib
import scipy.io.wavfile
import pydub
#a temp folder for downloads
temp_folder="/Users/home/Desktop/"
#spotify mp3 sample file
@raymondpittman
raymondpittman / letters-to-100.py
Created September 9, 2020 21:38 — forked from peterjmag/letters-to-100.py
Find English words whose letter values add up to 100
#!/usr/bin/env python
# encoding: utf-8
"""
letters-to-100.py
"""
import string
letter_values = dict((l, i) for i, l in enumerate(string.lowercase, start=1))
english_dict = open('/usr/share/dict/words', 'rU')
@raymondpittman
raymondpittman / problem.md
Created September 9, 2020 03:37 — forked from tomanistor/problem.md
Sum of Digits / Digital Root

In this kata, you must create a digital root function.

A digital root is the recursive sum of all the digits in a number. Given n, take the sum of the digits of n. If that value has two digits, continue reducing in this way until a single-digit number is produced. This is only applicable to the natural numbers.

Here's how it works (Ruby example given):

digital_root(16)
=> 1 + 6
=> 7
@raymondpittman
raymondpittman / words.py
Created September 8, 2020 03:38 — forked from piratus/words.py
Word value calculator
# coding: utf-8
"""Word value calculator.
Calculates word value as per http://9gag.com/gag/2506371
"""
from string import lowercase
LETTER_VALUES = {letter: index for index, letter in enumerate(lowercase, 1)}
def word_value(word):
@raymondpittman
raymondpittman / server.js
Created April 26, 2019 08:59
Just an example of not using body-parser
const express = require("express");
const mysql = require("mysql");
const app = express();
const PORT = 3000;
app.use(express.json()); // JSON-encoded body
app.use(express.urlencoded({extended: true})); // URL-encoded body
app.set('view engine','ejs');
@raymondpittman
raymondpittman / main.cpp
Last active April 26, 2019 08:37
C++ Caeser Cipher - CSC 101 - University of Southern Mississippi
/*
* Author: Raymond Pittman
* University of Southern Mississippi
*
* Caeser Cipher
*
*
*/
#include <algorithm>
@raymondpittman
raymondpittman / gist:d2321fd20544b6a94e2c73e0acf525ac
Created April 21, 2019 00:50 — forked from totherik/gist:3a4432f26eea1224ceeb
v8 --allow-natives-syntax Runtime Functions
Per https://code.google.com/p/v8/codesearch#v8/trunk/src/runtime.cc
%CreateSymbol
%CreatePrivateSymbol
%CreateGlobalPrivateSymbol
%NewSymbolWrapper
%SymbolDescription
%SymbolRegistry
%SymbolIsPrivate
@raymondpittman
raymondpittman / download_zip.js
Last active July 28, 2024 10:29
Native Javascript, automatically download a BLOB zip file using FETCH without the use of manual triggering clicking a DOM element. Will create a DOM element automatically and set the attribute HREF to a zip file or contents, then download file automatically on HTML file page load. Or also, will work through Node.js or another Fetch compatible Ja…
/*
* @Author Raymond Pittman
* @Github: https://github.com/raymondpittman
* @Note: Added README.md https://gist.github.com/raymondpittman/11cc82788422d1bddfaa62e60e5ec9aa
*/
/*
* @params
* @download: http://.zip
* @filename: ./downloaded.zip