Skip to content

Instantly share code, notes, and snippets.

View larsar's full-sized avatar

Lars Preben Sørsdahl larsar

View GitHub Profile

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

# Checkout
git tag # List tagged versions
git checkout -b prodfix <version> # Checkout specific version into prodfix branch
# Fix code and commit
# Test in staging (requires compatible database state)
git push staging +HEAD:master # Push to staging
# Put in producton
@larsar
larsar / gist:4622148
Created January 24, 2013 14:18
javac windows encoded files with Norwegian characters.
# Option for javac to accept java files with nasty Windows encoding:
-encoding cp1252
[HKEY_CLASSES_ROOT\Directory\shell\sublime]
@="Open Folder as &Sublime Project"
[HKEY_CLASSES_ROOT\Directory\shell\sublime\command]
@="\"C:\\Program Files\\Sublime Text\\sublime_text.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime]
@="Open Folder as &Sublime Project"
[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime\command]
@larsar
larsar / heroku_deployment_workflow
Created October 11, 2012 18:24
Heroku deployment workflow
Gjenskape produksjon:
Backup av staging og prod database:
heroku pgbackups:capture --remote staging
heroku pgbackups:capture --remote production
Clean staging-database:
heroku pg:reset DATABASE_URL --remote staging
@larsar
larsar / gist:2666576
Created May 12, 2012 13:42
Push different branch to heroku
git checkout -n new_branch
git push heroku +HEAD:master
git push -f heroku HEAD:master
Source: http://stackoverflow.com/questions/2971550/how-to-push-different-local-git-branches-to-heroku-master
@larsar
larsar / shared_folder_centos_virtualbox.txt
Created January 27, 2012 08:04
Mount shared folder on CentOS in VirtualBox
# The VirtualBox documentation[1] for how to install guest additions
# for Linux on a virtual host is somewhat messy. So here is what
# I did to make it work.
# Install the packages required
yum update
yum install gcc kernel-devel make
reboot
@larsar
larsar / openssl
Created January 26, 2012 09:24
OpenSSL notes
# Display certs for a server
openssl s_client -showcerts -connect <host.domain>:<port>
@larsar
larsar / gist:1408962
Created November 30, 2011 12:52
SSH not using authorized_keys with SELinux
restorecon -R -v /home
Source: http://blog.natesilva.com/post/9618889334/in-centos-linux-6-0-you-cant-ssh-using
@larsar
larsar / selinux-create-policy
Created November 14, 2011 14:46
Creating SELinux policy for failing stuff
For instance Puppet server will not start under RHEL SELinux. Try to start it, then run the following script. Continue this cycle until it starts. It will probably work for different SELinux challenges as well.
The script requires:
$yum install policycoreutils-python
cd /tmp && \
cat /var/log/audit/audit.log | audit2allow -m puppetmaster > puppetmaster.te && \
checkmodule -M -m puppetmaster.te -o puppetmaster.mod && \
semodule_package -m puppetmaster.mod -o puppetmaster.pp && \
semodule -i puppetmaster.pp