Skip to content

Instantly share code, notes, and snippets.

View mbrgm's full-sized avatar

Marius Bergmann mbrgm

View GitHub Profile
@mbrgm
mbrgm / gvfs.nix
Last active November 9, 2024 20:25
Non-root-NFS-enabled GVFS on NixOS
{ lib
, pkgs
, ... }:
let
package = pkgs.gnome.gvfs;
in {
@mbrgm
mbrgm / printer-prusa-mk3s-2021.cfg
Created August 11, 2021 23:28 — forked from nikolak/printer-prusa-mk3s-2021.cfg
Klipper MK3S/+ Config including optional Bondtech Extruder, Bear Extruder, etc.
# This file contains pin mappings and reasonable defaults for Prusa i3 MK3S
# printers. It will work with MK3 (non-S) by selecting the alternative filament
# sensor. References to common community mods are included as well.
#
# Note: The Einsy boards sold by Prusa have defective firmware on the
# usb-to-serial chip that makes the boards unusable with Klipper through USB.
# While flashing Klipper firmware must be done over USB, the board can be used
# via serial with no additional modification.
#
# To use this config, the firmware should be compiled for the AVR atmega2560.
@mbrgm
mbrgm / log.txt
Last active February 9, 2018 07:39
2018/02/08 12:45:45 [INFO] Packer version: 1.1.4-dev
2018/02/08 12:45:45 Packer Target OS/Arch: windows amd64
2018/02/08 12:45:45 Built with Go Version: go1.9
2018/02/08 12:45:45 Using internal plugin for digitalocean
2018/02/08 12:45:45 Using internal plugin for oracle-oci
2018/02/08 12:45:45 Using internal plugin for parallels-iso
2018/02/08 12:45:45 Using internal plugin for alicloud-ecs
2018/02/08 12:45:45 Using internal plugin for lxd
2018/02/08 12:45:45 Using internal plugin for oracle-classic
2018/02/08 12:45:45 Using internal plugin for azure-arm
@mbrgm
mbrgm / export_m3u8.py
Created August 31, 2017 22:41
Export songs from an m3u8 playlist to a directory
#!/usr/bin/env python
import os
import re
import sys
import shutil
from urllib.parse import unquote
def main():
playlist = sys.argv[1]
@mbrgm
mbrgm / crop.py
Created June 1, 2015 18:35
PDF page cropping
#!/usr/bin/env python
from pyPdf.pdf import PdfFileReader, PdfFileWriter, PageObject
import glob
import os
INPUT_DIR = 'input'
OUTPUT_DIR = 'output'
@mbrgm
mbrgm / dv_capture.scpt
Created April 3, 2015 10:28
AppleScript for semi-automated capturing of DV tapes to disk
-- You need the applications `AVCVideoCap.app` and `AVCBrowser.app` from the Mac
-- OS X Firewire SDK (from https://developer.apple.com/downloads/index.action#)
-- and an application for playing sounds (if you want to have an audible
-- notification when capturing is complete), e.g. `Play Sound.app` from
-- http://www.macupdate.com/app/mac/8479/play-sound. Feel free to adjust the
-- script as needed.
--
-- Tested on Mac OS X Mavericks (10.9).
--

Mac OS X one-liners

Recursively delete .DS_Store files

$ find . -name '*.DS_Store' -type f -delete

Remove empty folders

$ find . -type d -empty -delete
@mbrgm
mbrgm / version
Created January 26, 2014 17:42
Offers a way to get the current version in a git repository by finding the latest version tag and counting the number of commits since then, if necessary. The version tags are required to begin with a leading 'v'. The version format is <major>.<minor>.<patch>[-<prerelease-type>.<prerelease-number>][+<commit-number>].
#!/usr/bin/env python
import sys
import os
import re
import plistlib
from subprocess import check_output
class Version:
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@mbrgm
mbrgm / tokenize.py
Last active December 20, 2015 22:59
Extracts tokens from an input file for further natural language processing.
#!/usr/bin/env python
import argparse
import codecs
import nltk
def main():
# Parse arguments
parser = argparse.ArgumentParser(description='Tokenize an input file.')
parser.add_argument(dest='input_path', metavar='<file>', help='Input text file')