Skip to content

Instantly share code, notes, and snippets.

💻
Programming

Hosein Shahmohammady Mhs-220

💻
Programming
Block or report user

Report or block Mhs-220

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
@Mhs-220
Mhs-220 / google-tts.py
Last active Apr 3, 2019
Google TTS script for GoldenDict
View google-tts.py
import os
import sys
import json
import base64
user_input = ' '.join(sys.argv[1:])
# Payload that we should send to google api
payload = '{"input":{"text":"%s"},"voice":{"languageCode":"en-US","name":"en-US-Wavenet-D"},"audioConfig":{"audioEncoding":"LINEAR16","pitch":"0.00","speakingRate":"1.00"}}' % user_input
@Mhs-220
Mhs-220 / funcs.py
Created Aug 27, 2018
Add order field to graphene django
View funcs.py
import graphene
from graphene_django.filter import DjangoFilterConnectionField
class CustomDjangoFilterConnectionField(DjangoFilterConnectionField):
@classmethod
def connection_resolver(cls, resolver, connection, default_manager, max_limit,
enforce_first_or_last, filterset_class, filtering_args,
root, info, **args):
filter_kwargs = {k: v for k, v in args.items() if k in filtering_args}
qs = filterset_class(
@Mhs-220
Mhs-220 / handle_sns.py
Created Aug 27, 2018
A simple handler for aws sns in marketplace for flask
View handle_sns.py
@mod_auth.route('/handle_sns', methods = ['GET', 'POST', 'PUT'])
def handle_sns():
try:
notification = json.loads(request.data)
notification_type = notification["Type"]
if notification_type == 'SubscriptionConfirmation':
if 'SubscribeURL' in notification:
url = notification['SubscribeURL']
print("Click for subscribe -> %s" % url)
# There is another state for unsubscribe confirmation,
You can’t perform that action at this time.