Skip to content

Instantly share code, notes, and snippets.

@febbraro
febbraro / Git Completion and Prompt
Created March 24, 2011 03:50
When using git (specifically on OSX installed from homebrew) get some good git command completion and a cool prompt
# Put this in your ~/.bash_profile
# Git command and tag/branch completion as well as putting the branch
# in your prompt including a "*" if it is dirty (changed)
. /usr/local/etc/bash_completion.d/git-completion.bash
export GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\u@\h \[\033[1;33m\]\W\[\033[0m\]$(__git_ps1 "[%s]")\$ '
@febbraro
febbraro / user-scrub.sql
Created July 9, 2012 18:26
Cleanup / Obfuscate Drupal Users (sets default password for all users to 'test')
UPDATE users
SET name = CONCAT('user', (select @rownum:=@rownum+1 rownum FROM (SELECT @rownum:=0) r))
WHERE uid > 1;
UPDATE users
SET mail = CONCAT('user', (select @rownum:=@rownum+1 rownum FROM (SELECT @rownum:=0) r), '@example.com')
WHERE uid > 1;
UPDATE users
SET pass = '$S$DR.ROS3sDma71iTWcofZszOb8dMqrPi3PUWWNNc3rIwcG4ikL2gS'
@febbraro
febbraro / gist:3759185
Created September 21, 2012 00:55
Scala Example Exercise
package example
import common._
import java.util.NoSuchElementException
object Lists {
/**
* This method computes the sum of all elements in the list xs. There are
* multiple techniques that can be used for implementing this method, and
* you will learn during the class.
@febbraro
febbraro / gist:8672744
Last active January 4, 2016 20:19
Resize a coreos partition
1) cp /usr/lib/coreos/resize_state ~/fusion_resize_state
2) Remove the check "if sgdisk -v "$DISK_DEVNAME" | grep -q "^Problem: The secondary header"; then"
3) sudo -s
4) ./fusion_resize_state /dev/disk/by-label/STATE
5) Restart
6) ./fusion_resize_state /dev/disk/by-label/STATE
7) resize2fs /dev/sda9
...
???
...
@febbraro
febbraro / Dockerfile
Created August 13, 2015 19:31
servicebase
FROM centos:centos7
# Install our yum wrapper.
ADD root /
# Install base packages.
RUN yum -y install epel-release && \
yum -y update && \
yum -y install sudo ssh curl less vim-minimal dnsutils
✘  ~/Projects/phase2-aws/packer   master ●  packer build ami-build.json
east-ami output will be in this color.
==> east-ami: Prevalidating AMI Name...
==> east-ami: Inspecting the source AMI...
==> east-ami: Creating temporary keypair: packer 57a289b7-8f72-eaff-848d-de9e0450259f
==> east-ami: Launching a source AWS instance...
east-ami: Instance ID: i-14391784
==> east-ami: Waiting for instance (i-14391784) to become ready...
==> east-ami: Waiting for SSH to become available...
~/Projects/phase2-aws/packer   master ●  packer build ami-build.json
east-ami output will be in this color.
==> east-ami: Prevalidating AMI Name...
==> east-ami: Inspecting the source AMI...
==> east-ami: Creating temporary keypair: packer 57a37e8a-1e93-f36a-7b65-b3fbecb1a987
==> east-ami: Launching a source AWS instance...
east-ami: Instance ID: i-0c22099c
==> east-ami: Waiting for instance (i-0c22099c) to become ready...
==> east-ami: Waiting for SSH to become available...
@febbraro
febbraro / -
Created September 14, 2016 18:42
function lintJson() {
return gulp.src('*.theme.json')
.pipe(jsonlint())
.pipe(jsonlint.reporter());
}
gulp.task('validate:json', 'Test JSON', function() {
return lintJson().pipe(jsonlint.failAfterError());
});
tasks.validate.push('validate:json');
@febbraro
febbraro / -
Created September 14, 2016 18:51
// Setup the linting
function lintJson() {
return gulp.src('*.theme.json')
.pipe(jsonlint())
.pipe(jsonlint.reporter());
}
// Add a validate task that will fail on lint error
gulp.task('validate:json', 'Test JSON', function() {
return lintJson().pipe(jsonlint.failAfterError());
@febbraro
febbraro / -
Created September 14, 2016 18:52
https://gist.github.com/690800e4e5d24cdb95440be8cf168548