Skip to content

Instantly share code, notes, and snippets.

View pajtai's full-sized avatar

Peter Ajtai pajtai

  • https://www.soliddigital.com/
  • Portland, Oregon
View GitHub Profile
@pajtai
pajtai / _ using pf on macs.md
Last active August 29, 2015 14:15
Using pf for port forwarding on macs

Since ipfw is deprecated and removed on Yosemite and Maveriks, and there are no iptables on Mac you have to use pfctl for port forwarding.

This is important in Vagrant, where usually port 8080 is exposed, but you want to be able to use port 80 on your host browser.

Here is how to setup 80 <-> 8080 port forwarding on your mac (include empty lines at the end of each file... one of them is supposedly picky about it).

After adding the two files below as root, to start (enable) port forwarding do:

sudo pfctl -ef /etc/pf-vagrant.conf

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
<head>
<base href="/trailing">
</head>
<body>
<a href="go">GO GO GO</a>
</body>
<head>
<base href="/trailing/">
</head>
<body>
<a href="go">GO GO GO</a>
</body>
@pajtai
pajtai / data.js
Last active August 29, 2015 14:04
mongo import / export grunt task breaking it apart into one file per document using a configurable db endpoint
/*jshint node:true*/
module.exports = function (grunt) {
'use strict';
var _ = require('lodash'),
path = require('path'),
sep = path.sep,
databases = require('./databases');
grunt.registerTask('data:deleteTemp', function() {
@pajtai
pajtai / migrate.js
Last active August 29, 2015 14:04
gh core user migration to using identities
/* jshint node:true */
'use strict';
var _ = require('lodash'),
fs = require('fs');
migrateUsers();
migrateContentTypes();
function migrateUsers() {
@pajtai
pajtai / redirect.js
Created June 18, 2014 21:43
Express 4 redirect www.domain.com to domain.com
express.use(function(req,res,next){
var host = req.get('host');
if(/^www\./.test(host)){
host = host.substring(4, host.length);
res.writeHead(301, {'Location':req.protocol + '://' + host + req.originalUrl,
'Expires': new Date().toGMTString()});
res.end();
} else {
next();
}
define(['baseView', 'rivetsPlugin'], function(BaseView, rivetsPlugin) {
'use strict';
var rivetsView = new BaseView({
plugins : [rivetsPlugin]
});
});
@pajtai
pajtai / loadGruntConfigAndDependencies.js
Created December 2, 2013 04:29
Load all grunt tasks and load grunt config from a directory and set of files
loadGruntConfigAndDependencies('./initConfig/');
function loadGruntConfigAndDependencies (files) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig(loadConfig(files));
}
function loadConfig(files) {
var path = require('path'),
object = {};
@pajtai
pajtai / .gitconfig
Created February 6, 2013 18:27
Git aliases
[alias]
lg1 = log --graph --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative
lg2 = log --graph --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit
logo = log --oneline
stat = log --stat