Skip to content

Instantly share code, notes, and snippets.

@matabares
matabares / reverseproxyprototype.py
Created Jul 20, 2020
Reverse Proxy in flask proof of concept
View reverseproxyprototype.py
from flask import Flask, request, redirect, Response
import requests
app = Flask(__name__)
@app.route('/')
@app.route('/<path:path>', methods=['GET', 'POST', 'DELETE'])
View wordtonum.py
from __future__ import print_function
american_number_system = {
'zero': 0,
'one': 1,
'two': 2,
'three': 3,
'four': 4,
'five': 5,
View readspreadsheet.py
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import pandas as pd
View ejemplo.py
import pandas as pd
import numpy as np
from tabulate import tabulate
#chunksize = 10 ** 6
#for chunk in pd.read_csv('', chunksize=chunksize):
import os
source = 'c:/borreme/isa2/'
View jwtsample.py
import os
import logging
from flask import Flask, jsonify, request
from flask_jwt_extended import (
JWTManager, jwt_required, create_access_token,
get_jwt_identity
)
app = Flask(__name__)
app.config.from_object('config')
View manejoerrorandres.cs
void Main()
{
for (int i = 0; i < 500; i++)
{
try{
Execute();
}
catch (Exception e)
{
Console.WriteLine($"Hubo un error: {e.Message}");
@matabares
matabares / MusicBot.service
Created Oct 9, 2018
Ejemplo de la unit para systemd
View MusicBot.service
***MusicBot.service***
[Unit]
Description=MusicBot
After=multi-user.target
[Service]
Type=simple
ExecStart=/home/pi/bot/MusicBot/run.py
User=pi
WorkingDirectory=/home/pi/bot/MusicBot
View pubsubredis.py
#pub
REDISIO_PASSWORD = os.environ.get("CRAWLER_REDISIO_KEY")
redisClient = redis.StrictRedis(host='188.166.1.146', port=6379, db=0, password=REDISIO_PASSWORD)
redisClient.publish('NetsuiteMonitoringAlarmsChannel', alarmData)
# subs
redisClient=mtutils.getRedisClient()
subs=redisClient.pubsub()
subs.subscribe("NetsuiteMonitoringAlarmsChannel")
View validateTOTP.py
def ValidateTOTPAuth(code,token):
import pyotp
totp = pyotp.TOTP("EVVRU7CVMAGTOK6E")
print("Current OTP:", totp.now())
def CreateTOTPAuth(code,token):
import pyotp
print("Token", pyotp.random_base32())
@matabares
matabares / iterateindays.cs
Created May 16, 2018
Iterate over dates in c#
View iterateindays.cs
void Main()
{
DateTime StartDate = Convert.ToDateTime("15-08-2017");
DateTime EndDate = Convert.ToDateTime("15-08-2017");
foreach (DateTime day in EachCalendarDay(StartDate, EndDate))
{
Console.WriteLine("Date is : " + day.ToString("dd-MM-yyyy"));
}
}
You can’t perform that action at this time.