Skip to content

Instantly share code, notes, and snippets.

@andreav
andreav / aws-profile-chooser-bash-alias
Last active May 5, 2024 04:01
aws profile chooser and setter for bash. alias let me set AWS_PROFILE without launching another shell
alias aws-profile-chooser='x() { select prof in $( aws configure list-profiles ) ; do export AWS_PROFILE="$prof"; break; done }; x'
-------------------------------------------------------- deploy stack
$ HOSTNAME=$(hostname) docker stack deploy -c docker-stack.yml prom
-------------------------------------------------------- lista stacks
$ docker stack ls
NAME SERVICES ORCHESTRATOR
prom 5 Swarm
-------------------------------------------------------- rimuovi uno stack
$ docker stack rm prom
@andreav
andreav / .vimrc
Last active October 20, 2018 15:18
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
"
@andreav
andreav / .tmux.conf
Last active July 28, 2017 23:12
My tmux.conf and django-env-setup.sh
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
@andreav
andreav / get_field_from_bundle
Last active December 11, 2015 21:38
My drupal 7 snippets
# refs - http://www.computerminds.co.uk/articles/rendering-drupal-7-fields-right-way
# refs - http://drupal.stackexchange.com/questions/25148/views-and-contextual-filters-with-entity-reference-field
========================================================
$output = field_view_field('node', $node, 'field_name');
========================================================
That will return the sanitised, rendered field in its entirety, in the current language and in render-array form, so you'll get all the associated markup.
It will use the sites language fallback logic if the field has no values available for the current language. You can also pass an array of formatter options or specify a view mode as an optional argument.
@andreav
andreav / README
Last active December 11, 2015 04:38
drupal7 pack unpack bash scripts
>>>>> drupal7 pack unpack bash scripts <<<<<<<
* drupal7-install.sh is only used to install first time, and set right permissions
* copy drupal7-pack.sh drupal7-unpack.sh under "sites/all/custom/pack"
- work on your site from the UI
* run drupal7-pack.sh to export your repo to code, then commit and push
- Into another direcotory:
* clone your repo
@andreav
andreav / drupal7_pack_unpack_site_by_drush_and_bash
Last active December 11, 2015 04:29
drupal7_pack_unpack_site_by_drush_and_bash
refs: http://drupal.org/node/642116
refs: http://drupalovereasy.com/drupal-7/tutorials/installing-using-drush-make-git-profiles
refs: http://realize.be/exporting-more-configuration-drush-ctools-export-bonus
PACK:
# Starting from an up&running drupal site
#========================================
cd <drupal_repo_root>
@andreav
andreav / visual studio 2012 nunit integration
Last active December 10, 2015 22:18
Add external tool in Visual Studio to automatically launch NUnit on the current file
== LAUNCH NUnit FROM VS2012 ===========================================
TOOLS -> External Tool -> Add
Title: NUnit
Command: C:\path\to\nunit.exe
Arguments: $(TargetName)$(TargetExt)
Initial Directory: $(ProjectDir)\bin\Debug
TOOLS -> External Tool -> Add
@andreav
andreav / Failed to read file: private method `getc' called for #
Created January 7, 2013 11:12
Failed to read file: private method `getc' called for # referenced by issue at igloo15 / redmine_loader
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Project xmlns="http://schemas.microsoft.com/project">
<Name>Untitled</Name>
<Title>Untitled</Title>
<ScheduleFromStart>1</ScheduleFromStart>
<StartDate>2049-12-20T08:00:00</StartDate>
<FinishDate>2049-12-30T17:00:00</FinishDate>
<FYStartDate>1</FYStartDate>
<CriticalSlackLimit>0</CriticalSlackLimit>
<CurrencyDigits>2</CurrencyDigits>
@andreav
andreav / .bashrc
Last active March 29, 2018 16:30
My .bashrc hints
source /etc/bash_completion.d/git
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWBRANCHREMOTE=1
export GIT_PS1_SHOWUPSTREAM="verbose"
export PS1='\u@\h\[\e[1;32m\]$(__git_ps1 " %s")\[\e[m\] \w >'