Skip to content

Instantly share code, notes, and snippets.

View javier's full-sized avatar

javier ramírez javier

View GitHub Profile
@javier
javier / gist:fc90f3bbf265522d54526c2f0a44bdef
Created July 3, 2020 08:36 — forked from cmackay/gist:5863257
AppleScript to save and restore window position and sizes.
-- allSettings is a list of records containing {width:? height:? apps:{{name:? pos:? size:?},...}
-- for each display setup store the apps and their associated position and size
property allSettings : {}
-- create a variable for the current settings
set currentSettings to {}
display dialog "Restore or save window settings?" buttons {"Restore", "Save"} default button "Restore"
set dialogResult to result
@javier
javier / ffmpeg.md
Created May 13, 2020 09:36 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@javier
javier / BatchJob.java
Last active January 18, 2022 05:16
A tale of two streams workshop
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@javier
javier / ExportingXGBoostfromSageMakertoScikit-learn.ipynb
Created September 12, 2019 12:01
Exporting XGboost models from Amazon SageMaker to scikit-learn
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@javier
javier / opencv-python_rekognition.py
Created May 31, 2019 12:14 — forked from jakechen/opencv-python_rekognition.py
Using opencv to parse frames for Amazon Rekognition to analyze. This example uses Rekognition's celebrity recognition feature as an example.
# With help from https://aws.amazon.com/blogs/ai/build-your-own-face-recognition-service-using-amazon-rekognition/
frame_skip = 100 # analyze every 100 frames to cut down on Rekognition API calls
import boto3
import cv2
from PIL import Image
import io
rekog = boto3.client('rekognition')
@javier
javier / aa_setup.sh
Last active April 19, 2018 10:49
Pub Sub Quick demo for pulling
sudo pip install --upgrade google-cloud-pubsub
gcloud pubsub topics create cp300
gcloud pubsub subscriptions create cpsubs --topic=cp300
python
#that's it.. now just copy the contents of the python file
@javier
javier / pidgin_all_dbus_messages.py
Last active November 3, 2017 16:35
Messages from pidgin using dbus for reading messages and Tkinter for showing them on a desktop window
#!/usr/bin/env python
# to debug dbus, try dbus-monitor "type='signal',sender='im.pidgin.purple.PurpleService',interface='im.pidgin.purple.PurpleInterface',member='ReceivedImMsg'"
import tkinter as tk
import tkinter.scrolledtext as tkst
from pydbus import SessionBus
from gi.repository import GObject
from gi.repository import GLib
@javier
javier / countries.rb
Last active July 26, 2016 16:47
seed to load country codes and names
#put this file on your locales directory where you have your yaml files
{ :es => {
:countries => {
:AC => "Isla de la Ascensión",
:AD => "Andorra",
:AE => "Emiratos Árabes Unidos",
:AF => "Afganistán",
:AG => "Antigua y Barbuda",
@javier
javier / 000_audio_may.json
Last active March 14, 2017 20:05
Cloud Speech API and Natural Language JSON from teowaki's blog post
{
"config": {
"encoding":"FLAC",
"sample_rate": 16000,
"languageCode": "en-GB"
},
"audio": {
"uri":"gs://formatinternet_misc/theresa_may_mp_extract.flac"
}
}
from google.appengine.ext import vendor
vendor.add('lib')
import json
import os
import webapp2
#from oauth2client.contrib.appengine import AppAssertionCredentials
from httplib2 import Http