Skip to content

Instantly share code, notes, and snippets.

View convert_pitch_by_semitones.py
#!/usr/local/bin/python3
"""
Requires you to install ffmpeg with all options (or at least the rubberband module):
https://gist.github.com/Piasy/b5dfd5c048eb69d1b91719988c0325d8#gistcomment-2571754
Example usage:
$ ./convert_pitch_by_semitones.py /input.mp3 /output.mp3 -2
"""
import sys
@Vages
Vages / contact_formatter.py
Created Feb 28, 2017
Formats phone numbers
View contact_formatter.py
import os
filename = "mv17.csv"
phone_column = 2
with open(os.path.join(".", filename), "r") as f:
new_lines = []
for i, l in enumerate(f.readlines()):
if i == 0:
@Vages
Vages / combine_pdfs.py
Last active Feb 14, 2017
Combines multiple pdf files into one
View combine_pdfs.py
from PyPDF2 import PdfFileMerger
def merge(input_files, output_file):
merger = PdfFileMerger(strict=False)
for pdf in input_files:
merger.append(pdf)
output_file = ""
merger.write(output_file)
@Vages
Vages / mnemonic_pin.py
Last active Jan 8, 2017
A script to generate a random numeric pin along with a string of possible ‘phone keyboard phrases’ (using the letters shown on a phone keyboard, setting 1 to punctuation and 0 to language-specific letters).
View mnemonic_pin.py
from random import choice
available_numbers = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
numbers_to_letters = {"1":["."],
"2":["A", "B", "C"],
"3":["D", "E", "F"],
"4":["G", "H", "I"],
"5":["J", "K", "L"],
"6":["M", "N", "O"],
View karuba.py
from random import randint, sample
def enough_distance(m, t):
return not ((m + t) < 4 or ((12 - m) + (12 - t)) < 4)
def get_meeple_placements():
"""
Generates and prints the board game arrangement
"""
occupied_temple_spaces = set()
You can’t perform that action at this time.