Skip to content

Instantly share code, notes, and snippets.

View jcataluna's full-sized avatar

Jesús Cataluña Montejo jcataluna

View GitHub Profile
@jcataluna
jcataluna / gist:1dc2f31694a1c301ab34dac9ccb385ea
Created July 8, 2016 17:23
Script to save all images from a docker-compose.yml file
#!/bin/bash
mkdir -p out
for img in `grep image $1| sed -e 's/^.*image\: //g'`;
do
cleanname=${img/\//-}
tag=`docker images | grep $img | awk '{print $2}'`
echo "Exporting image: $img, tag:$tag ($cleanname)..."
docker save $img -o out/$cleanname.tar
@jcataluna
jcataluna / gist:0dc80c86a6d88c3946e261937bdd0c9c
Last active April 18, 2016 03:53
Finally a sed expression to remove ALL spaces and CR
find . -type f -print0 | xargs -0 sed -i -e "s/_id/id/g"
find . -type f -print0 | xargs -0 sed -i -e "s/\s//g"
find . -type f -print0 | xargs -0 sed -i -e :a -e '/$/N; s/[\r\n]//; ta;'
@jcataluna
jcataluna / s3.simple.console.policy
Created June 21, 2015 16:44
s3 policy to give access to console and bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1434903547000",
"Effect": "Allow",
"Action": [
"s3:List*",
"s3:Get*"
],
@jcataluna
jcataluna / gist:930a62c774d6168bfb92
Last active August 29, 2015 14:13
apt-get install without intenernet connection
From: http://askubuntu.com/questions/416937/apt-get-doesnt-work-behind-a-proxy
# 1st. Use --print-uris param to just get the deb files needed to perform installation
sudo apt-get install --print-uris --yes lib32ncurses5 lib32bz2-1.0 libxtst6:i386 lib32stdc++6 libgtk2.0-0:i386 > download.txt
# 2nd. Filter output
cat download.txt | grep 'http.*deb' | cut -d ' ' -f 1 | sed "s/'//g" > urls.txt