Skip to content

Instantly share code, notes, and snippets.

View finger-berlin's full-sized avatar

Alexander Finger finger-berlin

View GitHub Profile
@finger-berlin
finger-berlin / backup-all-ec2-into-ami.sh
Created September 25, 2014 15:26
AWS EC2 automated backup into AMIs
for h in $(ec2-describe-instances --filter instance-state-name=running | grep -iv stack | grep -iv autoscaling | grep Name | cut -f3,5 | tr "\t" ":" );
do echo $h;
INSTANCE=$(echo $h|cut -d: -f1);
INAME=$(echo $h|cut -d: -f2);
ec2-create-image $INSTANCE --name $INAME.$(date +%Y%m%d) --description $INAME.$(date +%Y%m%d) --no-reboot;
done
@finger-berlin
finger-berlin / gist:6475362
Created September 7, 2013 12:57
sed / gsed script to convert PHP code into ruby: <?php echo $camelCase ?> into <%= snake_case %>
$ gsed -e 's|<?php echo \(.*\) ?>|<%= \1 %>|g' -e 's/$\([a-z]*\)\([A-Z]\)/\1_\l\2/g' old_php_view.php > new_rails_view.erb
@finger-berlin
finger-berlin / deploy.rb
Last active December 17, 2015 18:49
Capistrano deploy.rb for nginx + rvm + unicorn + delayed_job on Ubuntu LTS 12.x (2013)
require 'capistrano/calendar/recipes'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets'
set :user, 'deployuser'
set :application, 'applicationname'
set :rvm_type, :system
set :rvm_ruby_string, "ruby-1.9.3-p392@#{application}"
@finger-berlin
finger-berlin / myapp.nginx.conf
Created September 3, 2012 09:06
nginx config for ruby
upstream myapp {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
server {
listen 80;
server_name .example.com;
@finger-berlin
finger-berlin / smb.conf
Created May 9, 2012 08:56
working smb.conf where some shares can be accessed by guest users and some share can only accessed by authenticated users
[global]
unix charset = UTF8
workgroup = XXX
netbios name = XXX
server string = %h server (Samba, Ubuntu)
interfaces = lo, eth2, 192.168.42.17/24
bind interfaces only = Yes
security = USER
Map to guest = Bad User
obey pam restrictions = Yes
@finger-berlin
finger-berlin / smb.conf
Created May 9, 2012 08:52
smb.conf for simple /var/www sharing ... make sure /var/www is owned by www-data...
[global]
unix charset = UTF8
workgroup = XXX
netbios name = XXX
server string = %h server (Samba, Ubuntu)
interfaces = lo eth0
bind interfaces only = Yes
security = SHARE
obey pam restrictions = Yes
guest account = www-data
@finger-berlin
finger-berlin / gist:2359572
Created April 11, 2012 14:17
Amazon AWS: Update SSL Cert. on existing LB
Which SSL certs are uploaded to Amazon:
$ iam-servercertlistbypath
Which LBs are running:
$ elb-describe-lbs --region eu-west-1
Now update the LB:
@finger-berlin
finger-berlin / servername.domain.tld
Created March 27, 2012 18:05
working nginx php5-fpm config...
server {
listen 0.0.0.0:80;
server_name servername.domain.tld;
root /home/project/htdocs;
location / {
index index.php index.html;
try_files $uri $uri/ /index.php;
}
@finger-berlin
finger-berlin / gist:1977765
Created March 5, 2012 10:22
osx postfix relay email config hints...
$ sudo vim /etc/postfix/main.cf
myhostname = local.yourdomain.tld
mydomain = yourdomain.tld
myorigin = $mydomain
relayhost = [smtp.your-isp.tld]:587
@finger-berlin
finger-berlin / beanstald.sh
Created February 29, 2012 16:35
OSX script for easy start & stop beanstalkd (brew version)
#!/bin/sh
daemon=beanstalkd
executable=/usr/local/bin/$daemon
port=11300
waldir=/usr/local/var/beanstalkd
logfile=/usr/local/var/log/beanstalkd.log
interface="127.0.0.1"
params="-l $interface -p $port -b $waldir"