Skip to content

Instantly share code, notes, and snippets.

View imrenagi's full-sized avatar
🏠
Take a look to my go-payment lib!

Imre Nagi imrenagi

🏠
Take a look to my go-payment lib!
View GitHub Profile
@imrenagi
imrenagi / build.gradle (app)
Created March 7, 2015 00:18
build.gradle configuration in app folder
apply plugin: 'com.android.application'
apply plugin: 'robolectric'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.imrenagi.roboelectric_testing"
minSdkVersion 15
package com.imrenagi.roboelectric_testing;
public class Person {
public Person(){
}
public int add () {
return 1;
}
case class SearchStream(userID: Long, timestamp: Long, query: String)
object SearchGen {
val lines = Source.fromFile("blog_tags.csv").getLines.toList
var words = lines.map(lines => lines.split(",")(1).replace("\"", "")).take(20).map(_.trim.toLowerCase)
def searchStream(): Gen[SearchStream] = {
val stream = for {
userID <- Gen.choose(0,100)
{
"access_token": "25c32831-0b79-4cd2-a9d6-6cae62c5096e",
"refresh_token": "35e2d158-2037-402e-a8ff-449276645480",
"expiration": 1511923827
}
@imrenagi
imrenagi / RSVPStreamProcessor.java
Created May 29, 2018 00:53
RSVPStreamProcessor
Pipeline p = Pipeline.create(dataflowOptions);
PCollection<String> rsvpInput = p.apply("pubsubReader", PubsubIO.readStrings().fromSubscription(options.getSubscriptionId()));
String gcsBucketPath = String.format("gs://%s", options.getOutputBucket());
DateTimeFormatter dtfOut = DateTimeFormat.forPattern("yyyy/MM/dd");
rsvpInput.apply(ParDo.of(new DoFn<String, String>() {
@ProcessElement
import (
mt "github.com/micro/go-micro/metadata"
)
// get user info from context passed by auth middleware
func getUserInfo(incomingContext context.Context) map[string]string {
userMap := map[string]string{}
//Start of Image Uploader
const path = require('path');
const os = require('os');
const fs = require('fs');
var Busboy = require('busboy');
const Storage = require('@google-cloud/storage');
const storage = new Storage();
const uuidv1 = require('uuid/v1');
//Start of Image Text Extractor
const vision = require('@google-cloud/vision');
const PubSub = require(`@google-cloud/pubsub`);
const client = new vision.ImageAnnotatorClient();
const pubsub = new PubSub();
exports.processImageFromGCSEvent = (event, callback) => {
const file = event.data;
import re
def extract_identity(data, context):
"""Background Cloud Function to be triggered by Pub/Sub.
Args:
data (dict): The dictionary with data specific to this type of event.
context (google.cloud.functions.Context): The Cloud Functions event
metadata.
"""
import base64
{
"name": "receipt_text_detector",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
"author": "Imre Nagi",
"engines": {
"node": ">=4.3.2"
},
"scripts": {