Skip to content

Instantly share code, notes, and snippets.

View fabito's full-sized avatar
🐮
Working from home

Fábio Franco Uechi fabito

🐮
Working from home
View GitHub Profile
@erans
erans / get_lat_lon_exif_pil.py
Created May 20, 2011 21:16
Get Latitude and Longitude from EXIF using PIL
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags"""
exif_data = {}
info = image._getexif()
if info:
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active July 4, 2024 17:31
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@iegik
iegik / gitignore2svnignore.sh
Last active November 6, 2021 05:23 — forked from luisfaceira/converter.sh
Oneliner to convert svn:ignore into .gitignore
#!/bin/bash
cat .gitignore | sed 's/^/\.\//g;s/\(.*\)\/\([0-9a-zA-Z\*\?\.]*\)$/svn propedit svn:ignore "\2" \1 /mg' | bash
@mattjj
mattjj / websocketcat-receive.js
Created October 27, 2012 20:47
a tiny node.js server that routes stdin to a websocket
var socket = io.connect(window.location.host);
var received;
socket.on('data', function (data) {
received = JSON.parse(data);
});
@fabito
fabito / jenkins_nginx_ci.template.json
Created November 9, 2012 22:47
AWS Cloudformation template which creates a server based on Amazon Linux and automatically installs jenkins with nginx (working as a reverse proxy).
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation template to deploy jenkins/nginx.",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type" : "String",
@zwaldowski
zwaldowski / MainContextListener.java
Created April 8, 2013 17:49
App Engine Cloud Endpoints backed by Shiro
package com.dizzytechnology.appengine.server.generic;
import com.google.api.server.spi.guice.GuiceSystemServiceServletModule;
import com.google.inject.*;
import com.google.inject.servlet.GuiceServletContextListener;
import org.apache.shiro.config.Ini;
import org.apache.shiro.guice.web.ShiroWebModule;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
@offlinehacker
offlinehacker / google_stt.py
Created June 14, 2013 07:35
Quick and dirty python implementation of client for google speech to text service using google speech stream API. It requires requests, pyaudio and pyflac to be installed. Don't forget to set your API key. Current limit seems to be around 5 minutes.
#!/usr/bin/python
import flac.encoder as encoder
import pyaudio
import sys
import requests
import random
from threading import Thread
from Queue import Queue, Empty
@foosel
foosel / mjpg-streamer.default
Created December 30, 2013 18:37
MJPG-Streamer init/default scripts by Sami Olmari (mirrored from http://pastebin.com/Eu5Cytk1 and http://pastebin.com/QCtC1sLc)
# Configuration for /etc/init.d/mjpg-streamer
# The init.d script will only run if this variable non-empty.
MJPG_STREAMER_USER="pi"
# Where mjpg-streamer is installed, this is important!
DAEMON_HOME=/home/pi/mjpg-streamer
# What arguments to pass to mjpg-streamer, here is few examples; You can change them by commenting one and
# uncommenting another:
@d11wtq
d11wtq / docker-ssh-forward.bash
Created January 29, 2014 23:32
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
@tmaybe
tmaybe / app.yaml
Last active June 14, 2016 18:49
sample code for caching API requests in GAE
application: apipemilucache
version: 0-1-3
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: cache.application