Skip to content

Instantly share code, notes, and snippets.

View fvztdk's full-sized avatar

Felipe Vaz fvztdk

  • Barcelona, Spain
View GitHub Profile
@fvztdk
fvztdk / docker_cleanup.sh
Created July 13, 2017 13:50
Docker cleanup
#!/bin/bash
#v1.1
docker rm -v $(docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null
docker rmi $(docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null
rm -rf /var/lib/docker/tmp/*
@fvztdk
fvztdk / test_ciphers.sh
Created June 27, 2017 13:47
Test ciphers ssl
#!/usr/bin/env bash
#from
#https://superuser.com/questions/109213/how-do-i-list-the-ssl-tls-cipher-suites-a-particular-website-offers
# OpenSSL requires the port number.
SERVER=localhost:443
DELAY=1
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
echo Obtaining cipher list from $(openssl version).
@fvztdk
fvztdk / logs.sh
Created April 11, 2017 14:50
DC/OS logs on command line
#list the containers
dcos task
#get the desired ID and run the next command
dcos task log --follow {ID}
@fvztdk
fvztdk / godmode.sh
Last active March 27, 2017 13:18
Docker godmode
#!/bin/bash
#This starts an ubuntu container with admin rights on the host file system
#Useful on bad configure docker machines
#---------------------------------------------------------------------------------
#USE WITH CAUTION !!!!
docker run -t -i -v /:/host ubuntu /bin/bash
#USE WITH CAUTION !!!!
#---------------------------------------------------------------------------------
@fvztdk
fvztdk / map.java
Created March 27, 2017 13:08
Map List<String> to Integer[] -> Lambda
list.stream().map(Integer::parseInt).toArray(Integer[]::new)
@fvztdk
fvztdk / alert_disk_space.sh
Created May 12, 2016 14:21
Check the used disk space, and if it's over the threshold make a post to your slack hook
SPACE_USED=$(df -h /dev/disk1 | grep -vE '/dev/disk1' | awk 'FNR == 2 { print $4 }' | cut -d '%' -f1 )
if [ $SPACE_USED -ge 90 ]; then
alert=$( echo "Running out of space on $(hostname) $SPACE_USED % used already")
curl -X POST --data-urlencode "payload={\"text\": \"$alert\"}" "your slack hook address goes here"
fi
@fvztdk
fvztdk / crop.txt
Last active March 27, 2017 13:13
Video crop ffmpeg ATC Chameleon
ffmpeg -i in.mp4 -filter:v "crop=out_w:out_h:x:y" out.mp4
out_w is the width of the output rectangle
out_h is the height of the output rectangle
x and y specify the top left corner of the output rectangle
ffmpeg.exe -i AW0001.mp4 -filter:v "crop=1280:720:0:0" camera1.mp4
ffmpeg.exe -i AW0001.mp4 -filter:v "crop=1280:720:0:720" camera2.mp4
@fvztdk
fvztdk / git_submode_copy.txt
Created September 16, 2015 14:57
Copy a submodule to the father project
git rm --cached submodule_path # delete reference to submodule HEAD (no trailing slash)
git rm .gitmodules # if you have more than one submodules,
# you need to edit this file instead of deleting!
rm -rf submodule_path/.git # make sure you have backup!!
git add submodule_path # will add files instead of commit reference
git commit -m "remove submodule"
@fvztdk
fvztdk / git_submode_update.txt
Created September 16, 2015 14:56
Git submodule update
//mode1
git submodule foreach --recursive git pull origin master
//mode2
git submodule update --recursive
//depending on the aligment of the planets, sometimes mode1 or mode2 works, sometimes none of them
@fvztdk
fvztdk / rails.txt
Created September 16, 2015 14:54
Fix Encoding Error Rails -> log writing failed. "\xC3" from ASCII-8BIT to UTF-8`
Nokogiri::XML('string with problem').serialize(:encoding => 'UTF-8')