Skip to content

Instantly share code, notes, and snippets.

@meonkeys
meonkeys / bash-bits
Created December 3, 2014 18:33
bashrc git enhancements, emotiprompt
GIT_PS1_SHOWDIRTYSTATE=y
GIT_PS1_SHOWSTASHSTATE=y
GIT_PS1_SHOWUNTRACKEDFILES=y
GIT_PS1_SHOWUPSTREAM=auto
# ~ the Emotiprompt(TM) ~
# idea came from: http://linuxgazette.net/122/lg_tips.html#tips.1
smiley() {
err=$?
if [[ $err == 0 ]]

Tutorial: Meteor in Windows using Vagrant

These days some people were discussing at meteor-talk group about running Meteor at Windows and I’ve recommended them using Vagrant. It’s a very developer-friendly piece of software that creates a virtual machine (VM) which let you run any operating system wanted and connect to it without big efforts of configuration (just make the initial installation and you have it working).

Many packages (I've tested) for running Meteor+Vagrant fails because Meteor writes its mongodb file and also other files inside local build folder into a shared folder between the Windows host and the Linux guest, and it simply does not work. So I've put my brain to work and found a solution: do symlinks inside the VM (but do not use ln. Use mount so git can follow it). It’s covered on steps 8 to 15.

If you have no idea what I’m talking about, I’ve made a tutorial to install Ubuntu Precise x86 through Windows command-line with Meteor very simple to follow

#!/bin/bash
# Install Ruby Centos 6 #
#################
# MUST BE RUN AS ROOT
set -o xtrace
cd /tmp
@meonkeys
meonkeys / time.txt
Created August 1, 2013 18:31
Strange time result
[vagrant@vm ~]$ time php -r 'echo "Foo\n";'
Foo
real 0m0.000s
user 0m0.000s
sys 0m0.047s
@meonkeys
meonkeys / netbeansTracePrinter.php
Created July 9, 2013 17:50
Run this within NetBeans PHP and you get a clickable stack trace. Files and line numbers link directly to the relevant code locations. Use in conjunction with https://gist.github.com/meonkeys/5959455 .
<?php
$pathMap = [
'/vagrant' => '/home/user/git/code',
];
$trace = '
/vagrant/foo/bar/Pager.php (131)
/vagrant/foo/bar/Main.php (25)
';
@meonkeys
meonkeys / fulltrace.js
Created July 9, 2013 17:39
JavaScript snippet/bookmarklet to transform a New Relic stack trace into something you can easily cut and paste. Use in conjunction with https://gist.github.com/meonkeys/5959547 .
javascript:(function(){$(".application_stack_trace").find("span.directory").each(function() {x = $(this);x.replaceWith(x.attr("data-tip").replace(/<wbr \/>/g, "").replace(/^.* called at /, '').replace(/(.*)\/\S+\.php $/, "$1/"))})})()
@meonkeys
meonkeys / test.sh
Last active December 17, 2015 07:09
demonstrate problem with composer vcs repo changes
#!/bin/bash
set -e
echo "+++create basic composer.json - require goodby/csv"
cat > composer.json <<EOF
{
"require": {
"goodby/csv": "*"
}
}
$ git clone git://tcpdf.git.sourceforge.net/gitroot/tcpdf/tcpdf
Cloning into 'tcpdf'...
remote: Counting objects: 8699, done.
fatal: read error: Connection reset by peer
fatal: early EOF
fatal: index-pack failed
@meonkeys
meonkeys / gist:5470168
Last active December 16, 2015 17:28
Send all traffic incoming on port 443 to port 8443. Useful since I run Jenkins as a non-root user and it binds to port 8443.
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
@meonkeys
meonkeys / gist:5360891
Created April 11, 2013 05:08
typical df output (`df -k /`, actually)
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 71061904 48824060 18628092 73% /