Skip to content

Instantly share code, notes, and snippets.

View diasjorge's full-sized avatar
🤖

Jorge Dias diasjorge

🤖
View GitHub Profile
@diasjorge
diasjorge / after_cd_virtualenv
Created December 3, 2015 11:25
Virtualenv and rvm integration
#!/usr/bin/env bash
# Automatically activate Git projects' virtual environments based on the
# directory name of the project. Virtual environment name can be overridden
# by placing a .venv file in the project root with a virtualenv name in it
function workon_cwd {
# Check that this is a Git repo
GIT_DIR=`git rev-parse --git-dir 2> /dev/null`
if [ $? == 0 ]; then
if [ $GIT_DIR == ".git" ]; then
@diasjorge
diasjorge / workaround
Last active December 1, 2015 22:08
fci-mode vs auto-complete
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
(setq pfl-packages
'(
(venv-initialize-interactive-shells) ;; if you want interactive shell support
(venv-initialize-eshell)
(defun activate-corresponding-virtual-env ()
(interactive)
(require 'fiplr)
(let ((dirname (file-name-nondirectory (fiplr-root))))
(message dirname)
(if (member "eureka-template" (venv-list-virtualenvs))
(venv-workon dirname))))
@diasjorge
diasjorge / gist:5b4227a4ed7734324c3a
Created July 7, 2015 11:14
Creating data ready containers
In order to generate the datasets the workflow would be like following:
The data is loaded into the mysql|riak|redis container and then changes to the data are made.
For bootstrapping we could load the data we have from our current dumps/backups.
We must ensure that the data directories for the services are mounted as volumes.
After we've made the changes to the data we want to export this. For this we'll do.
@diasjorge
diasjorge / gist:16227c563f10fce9ae95
Created June 18, 2015 12:52
Expand lvm disk size
echo '1' > /sys/class/scsi_disk/2\:0\:0\:0/device/rescan
fdisk /dev/sda
partprobe
pvcreate /dev/sda4
vgextend system /dev/sda4
@diasjorge
diasjorge / partman.cfg
Last active August 3, 2020 14:14
Partman example using lvm
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/device_remove_lvm_span boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-auto-lvm/new_vg_name string system
d-i partman-lvm/confirm boolean true
d-i partman/alignment string "optimal"
d-i partman-auto-lvm/guided_size string max
@diasjorge
diasjorge / Vagrantfile
Last active March 2, 2016 23:16
consul-swarm
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "phusion/ubuntu-14.04-amd64"
if Vagrant.has_plugin?("vagrant-cachier")
@diasjorge
diasjorge / gist:f79ecbdc2f9dd051d12a
Created March 19, 2015 09:18
jenkins stack trace
Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.76-b04 mixed mode):
"Executor #4 for master : executing projobs-production-merge #109" prio=10 tid=0x00007f004406c000 nid=0xc232 runnable [0x00007f00adb14000]
java.lang.Thread.State: RUNNABLE
at java.io.FileOutputStream.write(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:295)
at hudson.plugins.timestamper.TimestamperOutputStream.write(TimestamperOutputStream.java:102)
at hudson.plugins.ansicolor.AnsiHtmlOutputStream.write(AnsiHtmlOutputStream.java:157)
at java.io.FilterOutputStream.write(FilterOutputStream.java:125)
at hudson.plugins.ansicolor.AnsiColorBuildWrapper$2.eol(AnsiColorBuildWrapper.java:102)
Mar 09, 2015 9:11:16 AM hudson.Proc$LocalProc join
WARNING: Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
java.lang.Exception
at hudson.Proc$LocalProc.join(Proc.java:329)
at hudson.Proc.joinWithTimeout(Proc.java:168)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1587)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1379)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1277)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1268)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:2327)
@diasjorge
diasjorge / Guardfile
Last active August 29, 2015 14:10
Guradfile to work with fig
require 'guard/plugin'
require 'yaml'
module ::Guard
class Fig < ::Guard::Plugin
class FigProxy
def build(service = nil)
system "fig build #{service}"