Skip to content

Instantly share code, notes, and snippets.

View gonzafirewall's full-sized avatar
🏠
Working from home

Gonzalo gonzafirewall

🏠
Working from home
View GitHub Profile
@gonzafirewall
gonzafirewall / mailer.exs
Created September 27, 2024 20:30
Script enviador de Mail en elixir
Mix.install([:swoosh, :hackney, :mail])
Application.put_env(:myapp, Prueba.Mailer, adapter: Swoosh.Adapters.Gmail, access_token: {:system, "GMAIL_API_ACCESS_TOKEN"})
Application.put_env(:myapp, :email_conf, to_mail: "prueba_loca@gmail.com", from_mail: "prueba_loca@gmail.com")
defmodule Prueba.Mailer do
use Swoosh.Mailer, otp_app: :myapp
end
defmodule Prueba.Enviador do
from google.oauth2 import id_token
from google.auth.transport import requests
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
@gonzafirewall
gonzafirewall / boto_sns.py
Last active June 13, 2016 04:57 — forked from gjedeer/boto_sns.py
How to send a push notification directly to device using Python, Boto and SNS
import boto
import boto.exception
import boto.sns
import pprint
import re
def send_push(device_id, body):
region = [r for r in boto.sns.regions() if r.name==u'eu-west-1'][0]
sns = boto.sns.SNSConnection(
from flask import Flask
from flask import request, Response
app = Flask(__name__)
@app.route("/", methods=["POST"])
def index():
print request.form
return Response("ok")
# Require imagemagick
# require potrace
# sudo apt-get install imagemagick potrace
import os
import argparse
import glob
parser = argparse.ArgumentParser()
parser.add_argument(
"files", type=str, help="png2svg", nargs="*"
import sys
if len(sys.argv) > 1 and sys.argv[1] :
fname = sys.argv[1]
else:
fname = "req.txt"
f = open(fname, 'r+')
cmd = 'pex '
#!/usr/bin/env python
"""Simple script to merge multiple RRD files together.
Accepts any number of RRD file names as arguments. Produces an "rrdtool dump"
style file on stdout. The last RRD file should have a slot for every possible
record in the resulting merged RRD.
Run something like:
$ python simple-merge-rrd.py filea.rrd fileb.rrd filec.rrd | \