Skip to content

Instantly share code, notes, and snippets.

View feroult's full-sized avatar
always coding ;)

Fernando Ultremare feroult

always coding ;)
View GitHub Profile
@feroult
feroult / gist:b8c88fe38ddea4c2637725cc6ae82a15
Created February 5, 2021 14:56
Id Token Google Cloud Build
- name: gcr.io/cloud-builders/gcloud
entrypoint: "bash"
args:
- "-c"
- |
apt update && apt install jq -y
curl -X POST -H "content-type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-d '{"audience": "dexinapp"}' \
"https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/___SERVICE_ACCOUNT_EMAIL___:generateIdToken" | jq -r .token > /workspace/token.txt
@feroult
feroult / convert_to_pb.py
Last active March 3, 2024 23:22
Convert OpenSeq2Seq trained model to PB file
import tensorflow as tf
from open_seq2seq.utils.utils import get_base_config, check_logdir, create_model
# Change with your configs here
args_S2T = ["--config_file=/data/training/v5/config-J5x3.py",
"--mode=interactive_infer",
"--logdir=/data/training/v5/models",
"--batch_size_per_gpu=10",
]
@feroult
feroult / Person.kt
Last active October 4, 2017 11:46
YAWP Kotlin
@Endpoint(path = "/people")
class Person(@Id
var id: IdRef<Person>? = null,
var name: String? = null,
var age: Int? = null)
fun example() {
var person = Person(name = "John", age = 10)
print("${person.name} has ${person.age} years old")
@feroult
feroult / AppengineFirebaseAuth.java
Last active November 22, 2017 18:00
Firebase 3.0 + GAE
public class AppengineFirebaseAuth {
private static final String APP_ID = "YOUR_APP_ID";
public static AppengineFirebaseToken verifyIdToken(String token) {
Map<String, String> publicKeys = GooglePublicKeys.getKeys();
for (String kid : publicKeys.keySet()) {
String publicKey = publicKeys.get(kid);
@feroult
feroult / draw_maps.js
Created February 11, 2016 20:24
Draw Maps
module(maps, function() {
function AreaMap(selector, lat, lng, radius) {
var WINKEE_SQUARE = new google.maps.LatLng(-22.865964, -47.054778);
var center = WINKEE_SQUARE;
if (lat) {
center = new google.maps.LatLng(lat, lng);
}
@feroult
feroult / yawp-hierarchy.md
Last active January 20, 2016 11:51
YAWP! Hierarchy Mapping

Note: You should consider when to use ancestor/key design with care. You'll get a limit of 1 write/sec for each entity group.

First, map your entity endpoints:

  @Endpoint(path = "/users")
  public class User {
      @Id
      IdRef<User> id;
 
@feroult
feroult / yawp.py
Created January 13, 2015 11:11
Datastore change property tool
from google.appengine.ext import ndb
from google.appengine.api import datastore
from google.appengine.api import datastore_types
from google.appengine.api import datastore_errors
from functools import partial
# import yawp from yawp
# yawp('/people').query().fetch()
# http://stackoverflow.com/questions/10709893/ndb-expando-model-with-dynamic-textproperty
# http://stackoverflow.com/questions/19842671/migrating-data-when-changing-an-ndb-fields-property-type/19848970#19848970
goog.provide('n');
module(n, function() {
var started = false;
function go(path, callback) {
var controllerInfo = parse(path);
window[controllerInfo.controller][controllerInfo.action].call(this, controllerInfo.params, callback);
window.history.pushState('wink', "", path);
$('.dropdown.open .dropdown-toggle').dropdown('toggle');
@feroult
feroult / login.js
Last active August 29, 2015 14:01
Appengine devserver login/logout with QUnit Page JS
// See qunit-pages: https://github.com/murer/qunit-page
function login(page, user) {
page.step('login', function() {
page.stop();
$.get("/_ah/logout?continue=/blank.html", function(data) {
console.info("logout");
$.post('/_ah/login?continue=/blank.html', {
'email' : user + '@wavez',
'continue' : '/blank.html',
'action' : 'Log In'
http://rubyonrails.org/
http://guides.rubyonrails.org/
http://pragprog.com/book/rails4/agile-web-development-with-rails (excelente livro)
http://www.slideshare.net/dextra/minicurso-ruby-on-rails-dextra (palestra introdutória)