Skip to content

Instantly share code, notes, and snippets.

View supermasita's full-sized avatar
🤘
Calambre de trueno

Supermasita supermasita

🤘
Calambre de trueno
View GitHub Profile
@supermasita
supermasita / gist:8935da063725f456de45a7ebe86e59ad
Created May 3, 2016 21:41
Docker - Adding port to already runnning container (example)
sudo iptables -t nat -A DOCKER -p tcp --dport 443 -j DNAT --to-destination 172.17.0.1:443
@supermasita
supermasita / gist:decd55c44719005c5adc7ab27d844884
Created May 3, 2016 21:46
NGINX - Determine if user agent is mobile and add set a different proxy_cache_key
location ~ / {
# mobile users
if ($http_user_agent ~* '(iPhone|iPod|mobile|Android|2.0\ MMP|240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|hiptop|IEMobile)') {
set $ismobile '1';
}
proxy_cache_key $proxy_host$uri$ismobile;
add_header X-Is-Mobile $ismobile;
@supermasita
supermasita / sqlite2csv.sh
Created May 17, 2016 17:53
BASH - Export SQLite to CSV - Example
#!/bin/bash
# Export SQLite to CSV - Example
# Replace "$database" and "$table"
sqlite3 $database <<!
.headers on
.mode csv
.output $database.csv
select * from $table;
!
@supermasita
supermasita / ffmpeg-trim.txt
Last active May 19, 2016 18:22
FFMPEG or AVCONV - Example to trim (shorten) video without transcoding
# Valid for FFMPEG or AVCONV
# "-ss" : start
# "-t" : end
avconv -i input.flv -ss 00:00:00 -t 00:10:00 -c copy output.flv
@supermasita
supermasita / gist:da2c43501287a13d03b8069f6a3ae3a2
Created May 24, 2016 13:44
FIND + AWK - Find files older than N days and sum their total disk use
# seen on http://www.liamdelahunty.com/tips/linux_ls_awk_totals.php
# gives result in MB
find /opt/kaltura/dwh/cycles/process/ -type f -mtime +3 -exec ls -l {} \; | awk '{ SUM += $5} END { print SUM/1024/1024 }'
# http://stackoverflow.com/questions/9548755/powerpoint-ppt-to-jpg-or-png-image-conversion-using-php#16045442
## Dependencies
apt-get install unoconv
apt-get install imagemagick
## First converts your presentation to PDF
unoconv -f pdf presentation.ppt
## Then convert your PDF to jpg
convert presentation.pdf presentation_%03d.jpg
export HISTTIMEFORMAT='%Y-%m-%d %H:%M.%S | '
or add to .bashrc
@supermasita
supermasita / kaltura-basic_session_and_list.py
Created September 25, 2016 21:20
Kaltura - Basic session and media list with Python
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Kaltura API
Very basic example of how to start a session on Python get a list of entries
Should print something like
@supermasita
supermasita / gist:044ebe06954fe04d2653c13290b4c2b5
Created September 29, 2016 17:56
FFMPEG - Mux two videos into side by side rendition
ffmpeg -i happy01.mp4 -i happy02.mp4 -strict -2 -filter_complex "[0:v:0]pad=iw*2:ih[bg]; [bg][1:v:0]overlay=w" happy03.mp4

Keybase proof

I hereby claim:

  • I am supermasita on github.
  • I am supermasita (https://keybase.io/supermasita) on keybase.
  • I have a public key whose fingerprint is CF35 F2ED 74BC 544F AE36 C662 05D1 D32F 8D4C 5FD5

To claim this, I am signing this object: