Skip to content

Instantly share code, notes, and snippets.

View m42e's full-sized avatar

Matthias Bilger m42e

View GitHub Profile
## Dungeondraft Map Merger Utility
## Author: Brian Latwis
## Date: 04/09/2020
import argparse
import json
import random
from copy import deepcopy
## Create a set to store unique node ids
@bpkennedy
bpkennedy / installWonderdraftResources.sh
Last active April 13, 2020 04:46
Wonderdraft git config example
#!/bin/bash
# Example of simply copying from a local directory called /Wonderdraft which contains /assets, /maps, and /themes
# and recursively copies them up to the specified local paths in your wonderdraft.config file.
# Purpose is to allow all custom assets, maps, and themes to be source controlled and available across multiple OS types.
# This script expects to live and be executed from the project root.
# wonderdraft.config file should also live at the project root.
# You may need to grant permission to execute this script by your OS (`chmod 755 ./installWonderdraftResources.sh` in Linux/Mac, etc..)
@dhhdev
dhhdev / tmux-teacher.sh
Last active March 2, 2021 12:21
Only allow students to access sessions in progress with the read only flag, teachers can create tmux sessions as they wish.
#!/bin/bash
#
# ~/.tools/tmux-teacher.sh
#
# Author: Daniel H. Hemmingsen <dhh@v5.dk>
# Usage: tmux-teacher.sh session-name /path/to/start/from"
#
TEACHER_GROUP="teacher"
@gbaman
gbaman / HowToOTG.md
Last active May 2, 2024 01:27
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@mfarrugi
mfarrugi / benchmark-sort.py
Last active October 22, 2018 12:26
Benchmark shell scripts!
#/usr/bin/python
import sys
import re
lines = sys.argv[1]
ms_thresh = int(sys.argv[2])
lines = lines.split("\n")
lines = map(str.strip, lines)
@Bekbolatov
Bekbolatov / tmux.md
Last active March 7, 2024 01:18
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
@junegunn
junegunn / vimawesome.vim
Last active May 10, 2023 15:50
Plugin completion using VimAwesome API
" ----------------------------------------------------------------------------
" vimawesome.com
" ----------------------------------------------------------------------------
function! VimAwesomeComplete() abort
let prefix = matchstr(strpart(getline('.'), 0, col('.') - 1), '[.a-zA-Z0-9_/-]*$')
echohl WarningMsg
echo 'Downloading plugin list from VimAwesome'
echohl None
ruby << EOF
require 'json'
@omz
omz / Audio Recorder.py
Created February 3, 2015 00:07
Audio Recorder.py
from ctypes import c_void_p, c_char_p, c_double, c_float, c_int, cdll, util, c_bool
import os
import time
# Load Objective-C runtime:
objc = cdll.LoadLibrary(util.find_library('objc'))
objc.sel_getName.restype = c_char_p
objc.sel_getName.argtypes = [c_void_p]
objc.sel_registerName.restype = c_void_p
objc.sel_registerName.argtypes = [c_char_p]
@xavdid
xavdid / get_price_drop.py
Last active August 29, 2015 14:11
Grabs an appshopper feed url and returns the most recent discount
# Given an appshopper url, find the most recent price drop
# author: David Brownman
# www: davidbrownman.com
# NOTE: the clipboard module is unique to pythonista.
import clipboard
import feedparser
import re
import webbrowser
@bitoffdev
bitoffdev / Markdown Editor.py
Last active August 29, 2015 14:05
Markdown Editor.py
# Pythonista Markdown Editor
# By: EJM Software ---- http://ejm.cloudvent.net
# Source: http://gist.github.com/02df085647247a815eff
# *****************************************
import ui, console, editor, markdown, webbrowser, urllib
@ui.in_background
def new_md(sender):
filename = console.input_alert('', 'File Name')
if filename.find('.')>-1: