Skip to content

Instantly share code, notes, and snippets.

View level09's full-sized avatar
🌴
Always on vacation

Nidal Alhariri level09

🌴
Always on vacation
View GitHub Profile
@rkuykendall
rkuykendall / undirected_graph.py
Created May 9, 2014 00:09
Undirected Graph: Many-to-Many, Reflexive, Non-Directional Relationships in SQLAlchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine('sqlite://', echo=False)
session = sessionmaker(engine)()
Base = declarative_base()
"""An undirected graph example Modified from SQLAlchemy directed
graph example."""
@Xion
Xion / requestcontexttask.py
Created November 4, 2015 06:39
Base class for Celery tasks running inside Flask request context
from celery import Task
from flask import has_request_context, make_response, request
from myapp import app
__all__ = ['RequestContextTask']
class RequestContextTask(Task):
@levelsio
levelsio / btc-eth-dca-buy.php
Last active January 21, 2025 12:12
This script runs daily and "Dollar Cost Average"-buys $40 BTC and $10 ETH per day
<?
//
// [ BUY BTC & ETH DAILY ON BITSTAMP ]
// by @levelsio
//
// 2017-08-23
//
// 1) buy $40/day BTC
// 2) buy $10/day ETH
//
@aramalipoor
aramalipoor / Dockerfile
Last active April 9, 2025 15:20
Docker + Alpine + Newrelic + PHP (Kubernetes / AbarCloud)
# Prepare required directories for Newrelic installation
RUN mkdir -p /var/log/newrelic /var/run/newrelic && \
touch /var/log/newrelic/php_agent.log /var/log/newrelic/newrelic-daemon.log && \
chmod -R g+ws /tmp /var/log/newrelic/ /var/run/newrelic/ && \
chown -R 1001:0 /tmp /var/log/newrelic/ /var/run/newrelic/ && \
# Download and install Newrelic binary
export NEWRELIC_VERSION=$(curl -sS https://download.newrelic.com/php_agent/release/ | sed -n 's/.*>\(.*linux-musl\).tar.gz<.*/\1/p') && \
cd /tmp && curl -sS "https://download.newrelic.com/php_agent/release/${NEWRELIC_VERSION}.tar.gz" | gzip -dc | tar xf - && \
cd "${NEWRELIC_VERSION}" && \
@royalgarter
royalgarter / setup_btc_prune_node_ubuntu18_do.sh
Last active September 13, 2021 02:38
Setup Bitcoin Prune Node & LND on DigitalOcean Ubuntu 18.04 LTS
#!/bin/bash
# Prerequisites:
# 1/ ZeroMQ (for LN): https://gist.github.com/royalgarter/71abc75e1214bb39a1ef14a64639c17d
# Test after install bitcoin: btc getzmqnotifications
echo "########### This script was tested with DigitalOcean Ubuntu 18.04 LTS"
echo "########### The server will reboot when the script is complete"
echo "########### Changing to home dir"
cd ~
@timhughes
timhughes / fastapi_websocket_redis_pubsub.py
Last active February 21, 2025 08:41
FastAPI Websocket Bidirectional Redis PubSub
"""
Usage:
Make sure that redis is running on localhost (or adjust the url)
Install uvicorn or some other asgi server https://asgi.readthedocs.io/en/latest/implementations.html
pip install -u uvicorn
Install dependencies