Skip to content

Instantly share code, notes, and snippets.

@amercier
amercier / .bash_profile
Created September 7, 2013 16:36
Cygwin personal files
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any warranty.
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software.
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
# base-files version 4.1-1
# ~/.bash_profile: executed by bash(1) for login shells.
@amercier
amercier / macos-crontab-root.sh
Last active December 25, 2015 10:19
root's crontab on MacOS X Moutain Lion. Contains auto-updates for npm and gem.
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/mysql/bin
L=/var/log/cron
0 * * * * ([-d $L]||mkdir $L) && (echo -n "$(date) Updating NPM... " && npm -g update > /dev/null 2>> $L/npm-error.log && echo OK || echo NOK) >> $L/npm.log
0 * * * * ([-d $L]||mkdir $L) && (echo -n "$(date) Updating Gems... " && gem update > /dev/null 2>> $L/gem-error.log && echo OK || echo NOK) >> $L/gem.log
@amercier
amercier / macos-setup-dev.sh
Created October 13, 2013 11:22
Setup a fresh install of MacOS X Mountain Lion for development
# Fix Bash - http://hints.macworld.com/article.php?story=20071106192548833
sudo mv /bin/sh /bin/sh.orig
sudo ln -s /bin/bash /bin/sh
@amercier
amercier / macos-bash-aliases.sh
Created October 13, 2013 12:12
User bash aliases for Mac OS X Mountain Lion
#!/bin/bash
# Apache
alias apache-restart='sudo apachectl -k restart'
alias apache-start='sudo apachectl -k start'
alias apache-stop='sudo apachectl -k stop'
# Misc
alias show-ports="sudo lsof -i -P | egrep '^[^ ]+'"
alias show-open-ports="sudo lsof -i -P | grep LISTEN | egrep '^[^ ]+'"
@amercier
amercier / chrome-extensions.md
Last active December 25, 2015 10:29
Chrome Extensions I use with their configuration
#!/bin/bash
# Ensure we are root
[ "$(whoami)" == "root" ] || (echo "This script must be executed as root" & exit 1)
# Install dependencies
aptitude update \
&& aptitude upgrade \
&& aptitude install \
build-essential \
RewriteEngine on
# Forbid using IP address
#Rewritecond %{HTTP_HOST} ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$
#Rewriterule ^(.*)$ - [F]
# Forbid other domains
Rewritecond %{HTTP_HOST} !amercier\.com [NC]
RewriteRule ^ - [F]
#!/usr/bin/env sh
git remote | grep zendframework \
|| git remote add --track master zendframework https://github.com/zendframework/ZendSkeletonApplication.git
git fetch zendframework
git merge zendframework/master
#!/usr/bin/env bash
# ==============================================================================
# svn-to-git.sh - Migrate a SVN repository to Git
# ==============================================================================
echo "==============================="
echo "Migrate a SVN repository to Git"
echo "==============================="
echo
root = true
# Due to a bug in the EditorConfig for SublimeText, we set tab indentation for
# all files and we set exceptions for all files with an extension
[*]
indent_style = tab
indent_size = 4
end_of_line = lf