Skip to content

Instantly share code, notes, and snippets.

View xaman's full-sized avatar

Martín Chamarro xaman

View GitHub Profile
@xaman
xaman / slack_delete.py
Created June 29, 2017 14:13
Python script to delete Slack files (older than 1 month)
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import pycurl
import json
import time
from StringIO import StringIO
#
# Inspired by this Ruby version: https://gist.github.com/jamescmartinez/909401b19c0f779fc9c1
@xaman
xaman / readme.md
Created September 4, 2017 17:16 — forked from max-mapper/readme.md
Video stabilization using VidStab and FFMPEG (Mac OS X)

Video stabilization using VidStab and FFMPEG

Examples here use the default settings, see the VidStab readme on GitHub for more advanced instructions.

Here's an example video I made

Install ffmpeg with the vidstab plugin from homebrew

brew install ffmpeg --with-libvidstab
@xaman
xaman / git_fetch_all_remote_branches.sh
Last active November 21, 2017 13:27
Git: fetch all remote branches
#
# https://stackoverflow.com/a/10312587/2271287
#
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@xaman
xaman / send_file_to_pushbullet.py
Created December 19, 2017 10:00
Send file to Pushbullet
#
# https://dade.co.za/2016/06/17/simple-python-script-to-send-a-pushbullet-image/
#
import json
import requests
import sys
import os
# This is not a valid token, get your access token from https://www.pushbullet.com/#settings
@xaman
xaman / send_file_to_slack.sh
Created December 19, 2017 11:26
Send message and file to Slack
# Send message
WEBHOOK_URL="<SLACK_WEBHOOK_URL>"
curl -X POST --data "payload={\"text\": \":robot_face: MESSAGE\"}" ${WEBHOOK_URL}
# Rename versions and send them to Slack
SLACK_CHANNEL='#example'
SLACK_TOKEN='<SLACK_TOKEN>'
FILE_PATH="./path-to-file";
echo "Sending $FILE_PATH to Slack";
curl -F file=@"$FILE_PATH" -F channels=${SLACK_CHANNEL} -F token=${SLACK_TOKEN} https://slack.com/api/files.upload;
@xaman
xaman / clean_gradle_unused_cache.sh
Created January 23, 2018 11:28
Clean Gradle unused cache
# Author: https://twitter.com/kageiit/status/955717679435911169
find ~/.gradle -type f -atime +30 -delete
find ~/.gradle -type d -mindepth 1 -empty -delete
@xaman
xaman / format_with_raspbian.sh
Created February 1, 2018 11:50
Format a MicroSD with raspbian
# List disks
diskutil list
# Unmount selected disk
diskutil unmountDisk /dev/diskX
# Copy the content of the system image in the device
sudo dd bs=1m if=raspbian.img of=/dev/rdiskX conv=sync
# Sync changes
sync