Skip to content

Instantly share code, notes, and snippets.

@jo-lang
jo-lang / saddle_stich.jsx
Last active February 3, 2025 08:28
Script to place all pages of the current InDesign Document as links in a new document for saddle stitch binding
// For Adobe InDesign!
// this script will make a new file
// with the same dimensions as the currently active document
// and place the pages as linked files.
// The active source document needs a number of pages that is a multiple of 4 (4, 8, 12, 16, ...)
// Depending on the submitted pageamount per section
// the pages will be placed for saddle stitch binding.
// johannes lang january 2025
// not heavily tested, use at own risk!
@jo-lang
jo-lang / count-words-of-textfile.py
Last active January 26, 2023 09:30
Example script using a Counter to count occurancies of all words in a given text file
from collections import Counter
# Change the path to whatever file you want to be read
pth = 'MOBY-DICK.txt'
with open(pth) as f:
words = f.read().lower().split()
ct = Counter(words)
print (ct.most_common(100))
@jo-lang
jo-lang / braille-generator.py
Last active November 17, 2022 11:44
a braille text generator for drawbot
# a simple script to generate pdfs of (german) text converted to braille.
# this script need the drawbot app!
# This follows the DIN 32976
# a list of words
words = [
'This should output braille',
]
dot_s = 16 # the dot size 1.6mm
@jo-lang
jo-lang / timm_ulrichs_rotating_e.py
Created November 19, 2020 12:46
Interpretation of a work by Timm Ulrichs to be run in drawbot app
'''
An interpretation of a work by Timm Ulrichs
see this blog post: https://letterformarchive.org/news/shaped-text
See other solutions in this twitter-thread:
https://twitter.com/MauriceMeilleur/status/1329218247594561538
'''
# ---------------
# S E T T I N G S
@jo-lang
jo-lang / find_words_with_regex.py
Last active November 16, 2018 16:05
find words (with one or more of a selection of characters) in a source file and save them to a new file
# -*- coding: utf-8 -*-
import re
from random import shuffle
look_for = 'áàãâéêçíóôõúü'
omit = '[,:;.()!"?]'
max_amount = 2000000
pattern = r'[^\s]*'+ '[' + re.escape(look_for) + ']' + r'[^\s]*'
found_words = []