Skip to content

Instantly share code, notes, and snippets.

View ohld's full-sized avatar

Daniil Okhlopkov ohld

View GitHub Profile
@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@BusterNeece
BusterNeece / broadcast.sh
Created May 13, 2017 03:29
FunkyWayFM: The shell script used to merge the video feed and AzuraCast-powered radio feed into a single YouTube stream.
#! /bin/bash
VBR="1500k"
FPS="30"
QUAL="veryfast"
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"
KEY=""
VIDEO_SOURCE="/home/ubuntu/video3.mp4"
@ahopkins
ahopkins / sanic_feed.py
Last active September 28, 2019 21:08
Websocket feed using Sanic
from sanic import Sanic
import json
import asyncio
app = Sanic(__name__)
feeds = {}
class Feed(object):
@AO8
AO8 / crawler.py
Last active May 23, 2023 09:12
Crawl a website and gather all internal links with Python and BeautifulSoup.
# Adapted from example in Ch.3 of "Web Scraping With Python, Second Edition" by Ryan Mitchell
import re
import requests
from bs4 import BeautifulSoup
pages = set()
def get_links(page_url):
global pages
@caffeinum
caffeinum / simple-send.js
Last active September 25, 2020 12:25
Pure-JS OmniLayer sendtx
const bitcoin = require('bitcoinjs-lib') // version @3.3.2, ver4 won't work
const request = require('request-promise-native')
const net = process.env.NETWORK === 'testnet'
? bitcoin.networks.testnet
: bitcoin.networks.bitcoin
const API = net === bitcoin.networks.testnet
? `https://test-insight.swap.online/insight-api`
: `https://insight.bitpay.com/api`
@alfg
alfg / .travis.yml
Created January 19, 2019 05:44
Travis Git deployments to Dokku
language: bash
before_install:
- echo $super_secret_password | gpg --passphrase-fd 0 .travis/deploy.key.gpg
- eval "$(ssh-agent -s)"
- chmod 600 .travis/deploy.key
- ssh-add .travis/deploy.key
- ssh-keyscan git.host.com >> ~/.ssh/known_hosts
after_success:
- git remote add deploy dokku@git.host.com:app
- git config --global push.default simple
@ahopkins
ahopkins / # Sanic websocket feeds v2.md
Last active February 5, 2022 14:46
Sanic based websocket pubsub feed

Sanic Websockets Feeds v2

This is an outdated version

See latest

@ohld
ohld / update_metabase.sh
Created August 20, 2020 13:34
How to update Metabase if it is deployed via Dokku (Docker) and you migrated from default H2 (in my case to Postgres)
# Make sure you migrated from default H2 db to production-ready (like Postgres)
# because otherwise you'll loose data (dashboards, graphs, users)
docker pull metabase/metabase:latest
docker tag metabase/metabase:latest dokku/lu-metabase:latest
dokku tags:deploy lu-metabase
@marcantoine
marcantoine / showMetabaseQuestiontAsiOSWidget.js
Last active June 13, 2022 08:15
showMetabaseQuestiontAsiOSWidget.js
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// and @levelsio's https://gist.github.com/levelsio/a1ca0dd434b77ef26f6a7c403beff4d0
// HOW TO
// 1) Make a new Metabase Question
// 2) Make the result an unique number and choose Visualization > Number
// 3) Write your metabase domain, your email and password below
const domain = "https://metabase.endpoint.com"
const username = "my.e@mail.com"
const password = "p@ssw0rd"
@codingjoe
codingjoe / geodjango_macOS_arm64.md
Created March 11, 2021 10:29
HowTo run GeoDjango and PostGIS on M1 macOS arm64 MacBook
  1. Install PostgreSQL with PostGIS via Postges.app
  2. Install brew as recommended.
  3. Install dependencies:
    brew install geos gdal
    
  4. Add the following to your settings:
    # settings.py
    

GDAL_LIBRARY_PATH = os.getenv('GDAL_LIBRARY_PATH')