Skip to content

Instantly share code, notes, and snippets.

Ben Hur Bahia do Nascimento oxydron

Block or report user

Report or block oxydron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@oxydron
oxydron / pubsub_google_cloud_example.dart
Created Dec 10, 2019
Google Cloud Dart API pubsub example code. I'm sharing this code to help those that will try to use this lib on dart and maybe will find the docs poor to achieve this example.
View pubsub_google_cloud_example.dart
import 'package:googleapis/pubsub/v1.dart';
import 'package:googleapis_auth/auth_io.dart';
import 'credentials.dart';
const _SCOPES = const [PubsubApi.PubsubScope];
Future<PublishResponse> pubsubExample(Map<String, String> data) =>
clientViaServiceAccount(PUBLISH_PUBSUB_CREDENTIALS, _SCOPES).then((http) {
PubsubMessage msg = PubsubMessage();
msg.attributes = data;
View nao_usem_similaridade.py
def tokenizer(p, n=2):
p = '$' + p +'#'
tk_index = {}
tokens = []
for i in range(len(p)-1):
tk = p[i:i+n]
if tk in tk_index:
tk_index[tk] += 1
tokens.append(tk+str(tk_index[tk]))
else:
View nao_usem_similaridade.py
def tokenizer(p, n=2):
p = '$' + p +'#'
tk_index = {}
tokens = []
for i in range(len(p)-1):
tk = p[i:i+n]
if tk in tk_index:
tk_index[tk] += 1
tokens.append(tk+str(tk_index[tk]))
You can’t perform that action at this time.