Skip to content

Instantly share code, notes, and snippets.

@Vages
Vages / matematikk.js
Created December 31, 2021 07:22
A small library meant to be used in Kode 2
export function leggSammen(a, b) {
return a + b
}
export function multipliser(a, b) {
return a * b
}
#!/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 February 28, 2017 14:11
Formats phone numbers
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 February 14, 2017 15:11
Combines multiple pdf files into one
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 January 8, 2017 17:10
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).
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"],
@Vages
Vages / karuba.py
Last active December 26, 2016 20:03
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()