The goal of efficiency is more slack.

Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

Wednesday, July 08, 2020

ffmpeg write mp3 metadata

To create an mp3 file with some ID3 metadata. This example is to create files corresponding to chapters of an audiobook. Shell script:

#!/bin/sh

# Convert to mp3 with metadata. Use some defaults, pass some parameters.
# Parameters: 1: input file name, 2: chapter/track, 3: start time

ffmpeg -ss $3 -i "$1" -metadata artist="Some artist" -metadata album="An album name" -metadata genre="Books & Spoken" -metadata title=$2 -metadata track=$2 "Chapter $2.mp3"

Note that the first parameter is expected to be passed in in quotes if it has spaces.

Sunday, June 28, 2020

Thursday, October 10, 2019

VirtualBox Windows XP Guest File Sharing

How to share files hosted on a Windows XP VirtualBox guest on a Mac OS X host to a real Windows XP computer.
  1. Plug in Thunderbolt Ethernet adapter to host Macbook Air.
  2. Connect Ethernet cable between client computer and host Mac.
  3. Mac Host > Network Preferences > Thunderbolt Ethernet
    1. Configure IPv4: Manually
    2. IP Address: 10.11.0.1
    3. Subnet Mask: 255.255.0.0
  4. VM Settings > Network settings > Adapter [n]
    1. Attached to: Bridged Adapter
    2. Name: en3: Thunderbolt Ethernet
  5. Guest VM > Network Connections > Wired network > Properties >
    1. Internet Protocol (TCP/IP)
      1. Check Use the following IP Address or Alternate Configuration
      2. IP Address: 10.11.0.2
      3. Subnet Mask: 255.255.0.0
    2. Advanced > Windows Firewall > Settings > Exceptions > Check File and Print Sharing.
  6. Client computer > Network  Connections > Wired network > Properties > Internet Protocol (TCP/IP)
    1. Check Use the following IP Address or Alternate Configuration 
    2. IP Address: 10.11.0.3
    3.  Subnet Mask: 255.255.0.0
  7. (Optional test) Ping from each computer to the others.
  8. Guest VM > Share a folder
    1. Make folder C:\share
    2. Right click folder > Properties
    3. Check Share folder on network.
  9. Client computer > My Network Places > share on Guest VM
  10. Done

Sunday, June 16, 2019

Install Django on a development Mac

Notes on installing a Django development environment on a Mac.

Install Python

  • Install Python 3 from www.python.org.
  • Run Install Cerltificates.command.
  • Install pip and virtualenv
pip3 install --upgrade pip
pip3 install virtualenvwrapper
Put virtualenvwrapper in .bash_profile:
# Virtualenvwrapper
export VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
source /Library/Frameworks/Python.framework/Versions/3.6/bin/virtualenvwrapper_lazy.sh

Create a Python virtual environment

mkvirtualenv -p /usr/bin/python2 my_proj
cd ~/Documents/my_proj
setvirtualenvproject
-p is optional

Install Visual Studio Code

  • Install shell command: Cmd-Shift-p > shell command
  • Install Python extension.

Install Postgres


Install Django

pip install Django

Create directory

cd to the parent directory of the directory you wish to place the source files.
Create directory for source files with the Django startapp command.
django-admin startproject my_proj
cd my_proj
setvirtualenvproject

Create app

mkdir my_proj/my_form
./manage.py startapp my_form my_proj/my_form

Configure for VSCode

code . 
Create a new Django project in VSCode

Initialize git

git init
git add .
If .pyc files were uninentionally added:
git rm --cached '**.pyc'

Create .gitignore

touch .gitignore
code .gitignore
Input:
*.pyc

Static files

STATIC_URL: URL (relative to domain root) to trigger searching for static files.
STATICFILES_DIRS: List of directories in which to look for static files when collectstatic is run.
STATIC_ROOT: Django serves files from this directory when run under development mode. Also, collectstatic collects static files here. Upload this to server.

In development: project/static, sibling to project/manage.py
On production: /home/user/domain.com/public/static

settings.py:
STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'public/static/')   

Tuesday, December 12, 2017

Wednesday, September 13, 2017

Saturday, September 02, 2017

Disable mouse acceleration on Mac

Mouse acceleration makes it hard for me to point and click things based on muscle memory, so I turn it off by entering into the terminal:
defaults write .GlobalPreferences com.apple.mouse.scaling -1
Optionally, you can make an alias in ~/.profile and just enter the alias when you need to re-disable it, which you'll have to do often as the Mac resets this when you adjust mouse speed and sometimes upon login:
alias ma="defaults read .GlobalPreferences com.apple.mouse.scaling; defaults write .GlobalPreferences com.apple.mouse.scaling -1"
Note that the first command prints the current mouse acceleration, and the second one changes it.

Please let me know if you know a clean way to persist this setting.

Wednesday, May 19, 2010

Upgrading X11 Server on Mac OS X 10.5.8 Leopard

Before:
After:
Some programs found in the MacPorts repository use X. If you followed the default directions on the site as I did and decided to use Apple's X instead of MacPort's, your X is outdated and may cause some problems on those MacPorts installed apps. I got the upgrade in an easy-to-use installer by going to http://xquartz.macosforge.org/, clicking on Latest Release, and downloading the dmg (X11-2.5.0.dmg at the time of this writing).

Be warned that an Apple update will clobber this install. Therefore, you should get the latest X from http://xquartz.macosforge.org/ and install it after an Apple update.

git


My gitk (which uses X) stopped working after the update. I'm not sure if it was the update as I forgot if I ever ran it successfully before the update. Fix: I simply went to the git-osx-installer site on Google Code and downloaded the latest installer under Featured downloads on the sidebar.

Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

Powered by Blogger.
Scroll To Top