Skip to content

Instantly share code, notes, and snippets.

View carlessanagustin's full-sized avatar

carles san agustin carlessanagustin

View GitHub Profile
@carlessanagustin
carlessanagustin / build2scheduler.py
Last active August 29, 2015 14:08
(Python) Re-order dictionary for Buildbot CI Framework - Applied here: https://github.com/carlessanagustin/buildbot-bootstrap/blob/master/config/schedulers.py
build_names = []
build_names.append(dict(name='build_id', branch='master', slaves=['bbslave'],
scheduler=['single', 'force', 'periodic', 'nightly']))
build_names.append(dict(name='branch_id', branch='branch_id', slaves=['bbslave'],
scheduler=['single', 'periodic']))
build_names.append(dict(name='branch_idm', branch='master', slaves=['bbslave'],
scheduler=['single', 'force','periodic']))
print ''
print 'original: ', build_names
@carlessanagustin
carlessanagustin / auto-refresh-checkbox.js
Last active August 27, 2018 14:15
(Javascript) Auto refresh checkbox
<!-- add Javascript in html head -->
<script>
var reloading;
var refresh_time = 30000;
function checkReloading() {
if (window.location.hash=="#autoreload") {
reloading=setTimeout("window.location.reload();", refresh_time);
document.getElementById("reloadCB").checked=true;
}
@carlessanagustin
carlessanagustin / purge2.sh
Last active July 30, 2023 18:26
Script to reduce VM size before packaging for Vagrant v.2
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
# - https://gist.github.com/adrienbrault/3775253
## for vagrant related tasks, uncomment vagrant comments
# vagrant: Unmount project
@carlessanagustin
carlessanagustin / duf.sh
Last active August 16, 2017 13:57
Getting folder sizes through command line
# add next command to the command line
alias duf='du -sk * | sort -n | while read size fname; do for unit in k M G T P E Z Y; do if [ $size -lt 1024 ]; then echo -e "${size}${unit} - ${fname}"; break; fi; size=$((size/1024)); done; done'
# run next commands and see output
cd /
duf
# more info at http://www.carlessanagustin.com/2010/09/22/shell-como-obtener-el-tamano-de-carpeta-via-linea-de-comandos/
@carlessanagustin
carlessanagustin / VAGRANT-Cheat-Sheet.md
Last active November 7, 2023 20:27
This is a VAGRANT cheat sheet

Vagrant Cheat Sheet

add image

local

$ vagrant box add {title} {url}
$ vagrant init {title}
$ vagrant up
@carlessanagustin
carlessanagustin / static-network.ps1
Last active August 29, 2015 14:14
(PowerShell) Request static IP configuration and place it into a text file
## An A-Z Index of Windows PowerShell 2.0 commands: http://ss64.com/ps/
do {
$ip = Read-Host "Enter IP address"
$mask = Read-Host "Enter mask"
$gw = Read-Host "Enter default gateway"
Write-Host 'Is this information correct? IP $ip MASK $mask GW $gw'
$confirm = Read-Host "yes/no"
}while ($confirm -notlike "yes")
@carlessanagustin
carlessanagustin / detele-smarty-cache.sh
Created February 18, 2015 06:30
Clear Prestashop - Smarty cache
#!/bin/sh
sudo find $1/cache/smarty/cache -type f ! -regex ".*/\(index.php\)" -delete
sudo find $1/cache/smarty/compile -type f ! -regex ".*/\(index.php\)" -delete
sudo find $1/img/ tmp -type f ! -regex ".*/\(index.php\)" -delete
# continue reading: http://www.templatemonster.com/help/prestashop-1-6-x-how-to-clear-smarty-cache.html
@carlessanagustin
carlessanagustin / Vagrantfile-2xInstances.rb
Last active January 13, 2017 12:32
Vagrantfile for multi-machine configuration
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.boot_timeout = 60
config.vm.provider "virtualbox" do |vb|
vb.memory = 512
vb.cpus = 1
vb.gui = false
@carlessanagustin
carlessanagustin / nginx.conf
Last active August 29, 2015 14:16
Nginx app frontend / Load balancer / Static assets caching (not tested)
# Number of worker processes. Set it to the number of available CPU cores as a good start value or use 'auto' to autodetect it
worker_processes 4;
# User and group used by worker processes
user www-data www-data;
# Skip superfluous info in the main error log file
error_log /var/log/nginx/error_log error;
# Limit number of files a worker process can open
@carlessanagustin
carlessanagustin / nginx-min.conf
Last active August 29, 2015 14:16
Nginx simplified
server {
listen 80;
charset utf-8;
server_name your-site.com www.your-site.com;
#index index.html index.htm;
# myApp at port 8010
location /myApp {
return 301 http://$host:8010$request_uri;