Skip to content

Instantly share code, notes, and snippets.

new VM!!
first of all to set the command prompt, add this to ~/.profile and change the text needed to change:
PS1="\u@\e[0;31mTHISTEXTCHANGE\e[m \w $ \e[m"
next, install avahi: sudo apt-get install avahi-daemon
now you can log in by the hostname dot local!!
sudo apt-get install build-essential
git dependencies: sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
@guyguyon
guyguyon / dk oh-my-zsh theme
Last active August 29, 2015 14:26 — forked from kelmandor/dk oh-my-zsh theme
this is my custom oh-my-zsh theme that we use at crossrider so that the command line will have THE TIME when we issued commands.
# Adding time stamp to the russel theme
PROMPT='%{$fg_bold[yellow]%}%T% %{$fg_bold[red]%} ➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
#!/bin/sh
branch=`git rev-parse --abbrev-ref HEAD`
echo "Running tests before pushing...."
if [[ $branch == 'master' || $branch == 'develop' ]];
then
# SET IT TO YOUR OWN VIRTUALENV PATH !
source ~/virtualenv/mp_api/bin/activate
@guyguyon
guyguyon / feature_git_flow.md
Last active December 31, 2016 13:37
Feature git flow

install oh my zsh

Feature git flow

open branch:

  • gco -b FOLDER_NAME/FEATURE_NAME creates new branch locally
  • ggpush creates a remote branch
// First we define callbacks
const asyncHook = async_hooks.createHook({ init, before, after, destroy, promiseResolve });
// Then we enable the hooks
asyncHook.enable();
const fs = require('fs');
const async_hooks = require('async_hooks');
async_hooks.createHook({
init(asyncId, type, triggerAsyncId) {
fs.writeSync(1, `Init ${type} resource: asyncId: ${asyncId} trigger: ${triggerAsyncId}\n`);
},
destroy(asyncId) {
const eid = async_hooks.executionAsyncId();
fs.writeSync(1, `Destroy resource: execution: ${eid} asyncId: ${asyncId}\n`);
}
Calling setTimeout: execution: 1
Init Timeout resource: asyncId: 6 trigger: 1
Init TIMERWRAP resource: asyncId: 7 trigger: 1
Inside setTimeout: execution: 6
Destroy resource: execution: 0 asyncId: 6
Destroy resource: execution: 0 asyncId: 7
// node-request-context/namespace.js
const asyncHooks = require('async_hooks');
class Namespace {
constructor() {
this.context = {};
}
run(fn) {
// node-request-context/index.js
const Namespace = require('./namespace');
const namespaces = {};
function createNamespace(name) {
if (namespaces[name]) { throw new Error(`A namespace for ${name} is already exists`); }
const namespace = new Namespace();
namespaces[name] = namespace;
createHooks(namespace); // wait for explanation below
// node-request-context/index.js
const asyncHooks = require('async_hooks');
function createHooks(namespace) {
function init(asyncId, type, triggerId, resource) {
// Check if trigger has context
// Or in other words, check if tigger is part of any request
if (namespace.context[triggerId]) {
// Here we keep passing the context from
// the triggerId to the new asyncId