Skip to content

Instantly share code, notes, and snippets.

@optroodt
optroodt / gist:8298148
Created January 7, 2014 11:40
Extract single table from mysql dump file.
sed -n -e '/CREATE TABLE.*tablename/,/CREATE TABLE/p' database.sql > table.sql

How to get BennVenn' joey-joebags working on macOS

The joey-joebags is a Game Boy cart reader/writer, it's available here.

I have tested these steps on Yosemite (10.10) and Sierra (10.12). You need to have Python 3, which is not installed by default, so install using Homebrew.

Install Homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@optroodt
optroodt / sublime-keymap.json
Created March 27, 2018 11:28
OS X Eclipse key bindings for Sublime Text 3
[
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
{ "keys": ["super+alt+down"], "command": "duplicate_line" },
{ "keys": ["super+d"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} },
]
# uninstall packages installed by pip
pip freeze | xargs pip uninstall -y
# see which packages depend on a package:
pip show <insert_package_name_here>| grep ^Require
@optroodt
optroodt / on_exception.py
Created August 5, 2019 13:11
Start (i)pdb on exception
python -m pdb -c continue myscript.py
@optroodt
optroodt / generate.py
Created November 15, 2019 10:44
Generate 1000 text files with random words
import pathlib
import random
dictionary = pathlib.Path("/usr/share/dict/web2") # It's there on MacOS
words = set()
with dictionary.open("r") as f:
for l in f:
words.add(l.strip())
@optroodt
optroodt / remove_trailing_whitespace.sh
Created December 5, 2019 12:48
Remove trailing whitespace with sed on os X
find . -iname "*.py" -exec sed -i '' -E 's/[ '$'\t'']+$//' {} \;
@optroodt
optroodt / instructions.txt
Created May 31, 2020 18:59
Build forked-daapd for Raspberry Pi Model B
Latest Raspbian (2020-02-14) based on Debian 10 Buster
====
# Add ssh file to boot partition
sudo apt-get update
sudo apt-get install \
build-essential git autotools-dev autoconf automake libtool gettext gawk \
gperf antlr3 libantlr3c-dev libconfuse-dev libunistring-dev libsqlite3-dev \
libavcodec-dev libavformat-dev libavfilter-dev libswscale-dev libavutil-dev \
libasound2-dev libmxml-dev libgcrypt20-dev libavahi-client-dev zlib1g-dev \
@optroodt
optroodt / replace_black.sh
Created July 13, 2021 12:30
Replace black formatter version in several repos (hacky)
#!/bin/bash
OIFS=$IFS
IFS="
"
ORIGNAL_BLACK="lgeiger/black-action@master"
NEW_BLACK="tripactions/black-code-formatter@21.4b1"
BRANCH="youri/update_black_code_formatter"
for i in `grep -iER "lgeiger/black-action@master" --include "*.yml" .`
@optroodt
optroodt / gist:12ed4c6d519cd91825097d9dcf9cf3b5
Created March 20, 2023 09:31
Sublime Key Bindings (Preferences > Key Bindings)
[
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
{ "keys": ["command+alt+down"], "command": "duplicate_line" },
{ "keys": ["command+d"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["command+shift+l"], "command": "lower_case" },
{ "keys": ["command+shift+u"], "command": "upper_case" }
]