Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import subprocess
import re
# Get process info
ps = subprocess.Popen(['ps', '-caxm', '-orss,comm'], stdout=subprocess.PIPE).communicate()[0].decode()
vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0].decode()
# Iterate processes
# Change Prompt
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
export PS1='\[\033[0;34m\]\w \[\033[1;92m\]$(__git_ps1 "(%s)")\[\033[0m\]\n→ '
# Set proper path
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
export PATH=$PATH:/Users/alfons/bin
# System Aliases

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@alfonsfoubert
alfonsfoubert / getAge.js
Created October 4, 2013 16:33
Javascript calculate age function
/**
* Tells you the age from a string date
*
* @param dateString Date in string format ex: "1981/3/27"
*
* @return integer The calculated age
**/
function getAge( dateString ) {
var today = new Date();
var birthDate = new Date(dateString);
@alfonsfoubert
alfonsfoubert / strtotime.js
Created October 4, 2013 16:21
PHP strtotime function in javascript
/**
* Convert string representation of date and time to a timestamp
*
* @param text string modification
* @param now date (optional) origin date
*
* @return date or null
*
* note 1: Examples all have a fixed timestamp to prevent tests to fail because of variable time(zones)
*