Skip to content

Instantly share code, notes, and snippets.

View alertor's full-sized avatar

Stefan Taranu alertor

  • Bucharest, Romania
View GitHub Profile
@alertor
alertor / crypto_news.json
Created December 24, 2020 16:04 — forked from stungeye/crypto_news.json
News Site RSS Feeds
[
{
"url": "http://money.cnn.com",
"rss": "http://rss.cnn.com/rss/money_topstories.rss"
},
{
"url": "http://thehill.com",
"rss": "http://thehill.com/rss/syndicator/19110"
},
{
@alertor
alertor / pubsub_iot.py
Created July 22, 2020 08:14 — forked from skirdey/pubsub_iot.py
Connecting to AWS IoT MQTT topic using Python and Paho MQTT client
import paho.mqtt.client as paho
import os
import socket
import ssl
from time import sleep
from random import uniform
import json
import logging
logging.basicConfig(level=logging.INFO)
@alertor
alertor / blinker_signal.py
Created November 27, 2019 18:31 — forked from doobeh/blinker_signal.py
Blinker/Signal Flask Example
from flask import Flask, current_app
from blinker import Namespace
app = Flask(__name__)
app.secret_key = 'WOO'
my_signals = Namespace()
def moo_signal(app, message, **extra):
@alertor
alertor / gist:c9cacc43fea650f540e0d44c603e9254
Created March 22, 2019 13:16 — forked from andyshinn/gist:3511fbd091dc87ad78771e380fb527d4
Mimicking CORS preflight responses in Apache
<VirtualHost _default_:443>
ServerName yourhost
ServerAdmin someperson@yourorg.com
SSLEngine on
SSLCertificateFile /etc/ssl/private/yourorg.com.crt
SSLCertificateKeyFile /etc/ssl/private/yourorg.com.key
SSLCertificateChainFile /etc/ssl/private/chain.pem
SSLProxyEngine On
@alertor
alertor / flask_gunicorn_app.py
Created October 8, 2018 15:19 — forked from KatiRG/flask_gunicorn_app.py
Running Flask with Gunicorn
# This gist shows how to integrate Flask into a
# custom Gunicorn-WSGI application described
# here: http://docs.gunicorn.org/en/stable/custom.html
from __future__ import unicode_literals
import multiprocessing
import gunicorn.app.base
@alertor
alertor / app.py
Created October 1, 2018 08:15 — forked from jmvrbanac/app.py
Using Jinja2 with Falcon
import os
import falcon
import jinja2
def load_template(name):
path = os.path.join('templates', name)
with open(os.path.abspath(path), 'r') as fp:
return jinja2.Template(fp.read())
@alertor
alertor / amazon-rekognition.md
Created September 20, 2018 09:53 — forked from alexcasalboni/amazon-rekognition.md
Amazon Rekognition - Python Code Samples

Amazon Rekognition - Python Code Samples

  1. Labels Detection
  2. Faces Detection
  3. Faces Comparison
  4. Faces Indexing
  5. Faces Search
@alertor
alertor / get_youtube_id.py
Created September 13, 2018 10:36 — forked from silentsokolov/get_youtube_id.py
Python: get youtube id
# Get youtube id
#http://youtu.be/5Y6HSHwhVlY
#http://www.youtube.com/embed/5Y6HSHwhVlY?rel=0
#http://www.youtube.com/watch?v=ZFqlHhCNBOI
regex = re.compile(r'(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/(watch\?v=|embed/|v/|.+\?v=)?(?P<id>[A-Za-z0-9\-=_]{11})')
match = regex.match(self.youtube_url)

Linux - Systemd cheatsheet

systemctl

Activates a service immediately:

systemctl start foo.service

Deactivates a service immediately: