This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check the name of metabase container | |
docker ps | |
# make a backup | |
docker cp metabase:/metabase.db /root/ | |
# get updated version | |
docker pull metabase/metabase | |
# remove old running container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
VBR="1500k" | |
FPS="24" | |
QUAL="superfast" | |
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" | |
KEY="z5k3-8888-69qu-9999" | |
VIDEO_SOURCE="/home/root/cover.gif" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
VBR="1500k" | |
FPS="24" | |
QUAL="superfast" | |
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" | |
KEY="z5k3-8888-69qu-9999" | |
VIDEO_SOURCE="/home/root/cover.gif" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, json | |
from flask import Flask, request | |
app = Flask(__name__) | |
FNAME = "song.txt" | |
@app.route('/', methods=['POST','GET']) | |
def index(): | |
with open(FNAME, "w") as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create Dokku app | |
dokku apps:create metabase | |
# Pull Metabase instance from Docker | |
docker pull metabase/metabase | |
# Retag Dokker to allow Dokku to understand everything | |
docker tag metabase/metabase:latest dokku/metabase:latest | |
# Deploy Metabase Instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is Python port of this Javascript method: | |
# https://github.com/notslang/instagram-id-to-url-segment/blob/master/lib/index.coffee | |
url = "https://www.instagram.com/p/B8iwlG9pXHI/" | |
# ----> use regexp to extract code from url | |
code = "B8iwlG9pXHI" | |
charmap = { | |
'A': '0', | |
'B': '1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- my_django_app/templates/admin/broadcast_message.html --> | |
<!-- This block will be included to django admin basic template --> | |
{% extends "admin/base_site.html" %} | |
{% block content %} | |
<form action="" method="post">{% csrf_token %} | |
<!-- The code of the form with all input fields will be automatically generated by Django --> | |
{{ form }} | |
<!-- Show the list of selected objects on the previous step --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# your_app/admin.py | |
# ... imports | |
@admin.register(User) | |
class UserAdmin(admin.ModelAdmin): | |
actions = ['broadcast'] # register method as action | |
def broadcast(self, request, queryset): | |
if 'apply' in request.POST: # if user pressed 'apply' on intermediate page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"builds": [{ | |
"src": "index.py", "use": "@now/python" | |
}], | |
"routes": [ | |
{ "src": "/(.*)", "dest": "index.py" } | |
], | |
"env": { | |
"TELEGRAM_TOKEN": "@telegram-token" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import logging | |
import telegram | |
from flask import Flask, jsonify, request | |
app = Flask(__name__) | |
@app.route('/api', methods=['POST']) | |
def api(): | |
bot = telegram.Bot(token=os.getenv("TELEGRAM_TOKEN")) |