Skip to content

Instantly share code, notes, and snippets.

View klappradla's full-sized avatar

Max Mulatz klappradla

View GitHub Profile
@klappradla
klappradla / reset file attributes
Last active August 29, 2015 14:22
clean up file attributes when transferring vom ExFat to OSX
# ExFat format marks files without extension as 'Unix Executable'
# to restore original behaviour,
# remove executable bits from files and only set for directories
# recursively remove executable bits from all files
sudo chmod -R -x *
# remove executable bits from all hidden files (e.g. .gitignore)
sudo chmod -R -x .*
# set executable bit for directories (not accessible otherwise)
@klappradla
klappradla / lame.sh
Last active December 10, 2022 20:02
Using lame command line tool (e.g. convert flac to mp3
# Convert .flac to .mp3 (lossless)
for f in *.flac; do ffmpeg -i "$f" -aq 1 "${f%flac}mp3"; done
# Convert .flac to .mp3, compress to ~ 120k
for f in *.flac; do ffmpeg -i "$f" -aq 5 "${f%flac}mp3"; done
# Convert .flac to mp3, compress to ~ 128k
for f in *.flac; do ffmpeg -i "$f" -b:a 128k "${f%flac}mp3"; done
# Convert .flac to mp3, compress to variable 190k
@klappradla
klappradla / vim_color_template.vim
Created September 6, 2015 11:20
vim color scheme template (work in progress)
" Vim color scheme
"
" Name: theme name
" Maintainer: maintainer email
" URL: repo url
" General info
" ----
" useful help screens
@klappradla
klappradla / post-deploy.yml
Created November 27, 2015 12:12
Rake tasks as post deploy hooks for AWS Elastic Beanstalk Puma-Rails applications
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/01_do_stuff.sh" :
mode: "000755"
owner: ec2-user
group: ec2-user
content: |
#! /usr/bin/env bash
# Using similar syntax as the appdeploy pre hooks that is managed by AWS
set -xe
@klappradla
klappradla / postgres_4_2.md
Last active February 13, 2020 21:58
Install Postgres 9.4 and Postgis 2.1 server on EC2 Ubuntu instance (14.04)

Create Postgres / Postgis Server EC2 Box

Launch Ubuntu instance

  1. Click on Launch Instance` button
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type
  3. Configure Security Group
    In step 6 Configure Security Group add the rule:
    Type: PostgreSQL
    Protocol: TCP
    PortRange: 5432 (default postgres port)
function install {
echo installing $1
shift
apt-get -y install "$@" >/dev/null 2>&1
}
echo updating package information
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt trusty-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
apt-add-repository -y ppa:brightbox/ruby-ng >/dev/null 2>&1
@klappradla
klappradla / mysql.sh
Last active August 10, 2016 09:17
Install MySQL on El Capitain
# Install via homebrew
brew install mysql
# Start server via brew services
brew services start mysql
# Login as root to mysql command line tool
mysql -uroot
# Within mysql:
@klappradla
klappradla / docker.sh
Last active August 21, 2016 11:00
Stop and remove all Docker containers (running or not), interactive console in container
# Stop and remove all docker containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
# Run an interative console (like byebug or pry)
docker-compose run --service-ports appname
@klappradla
klappradla / cassandra12.sh
Last active August 4, 2016 13:10
Install Cassandra v.1.2 on OSX
# Install Cassandra version 1.2.9
mkdir ~/tmp
cd ~/tmp
curl -O http://archive.apache.org/dist/cassandra/1.2.9/apache-cassandra-1.2.9-bin.tar.gz
tar -xzf apache-cassandra-*
rm -rf *.tar.gz
# Create cassandra lib/log directory and grant access to it?
sudo mkdir /var/lib/cassandra
sudo mkdir /var/log/cassandra
@klappradla
klappradla / rubyracer.sh
Created August 9, 2016 14:16
Install rubyracer gem (v. 0.12.0)
brew install v8-315
bundle config --local build.libv8 --with-system-v8
bundle config --local build.therubyracer --with-v8-dir=/usr/local/opt/v8-315
bundle install