Skip to content

Instantly share code, notes, and snippets.

@noor-jafri
noor-jafri / docker-setup.sh
Last active June 25, 2024 08:44
Docker - DockerCompose - Let's Encrypt
#!/bin/bash
# Function to display a message with a timestamp
function echo_with_timestamp() {
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $1"
}
echo_with_timestamp "Starting pre-installation script for Docker and (optionally) Certbot..."
# Update and upgrade the package lists
@noor-jafri
noor-jafri / simple_upload.py
Last active April 11, 2018 21:07
Simple File Upload - Make Sure to have a folder named upload in the same directory
import os
from flask import Flask, request, redirect, url_for
from werkzeug import secure_filename
PROJECT_HOME = os.path.dirname(os.path.realpath(__file__))
UPLOAD_FOLDER = '{}/uploads/'.format(PROJECT_HOME)
ALLOWED_EXTENSIONS = set(['txt','pdf'])
app = Flask(__name__)
import RPi.GPIO as GPIO #Initialising GPIO
import time
# This Code Runs the Flask Web API, you can run on remote RPI or the Local One
#
#
#
#You can add more ports and routes to add further object.
import nltk
import speech_recognition as sr
# You can run this code on the same RPI where Flask Server is running or on your Hosts to access
# remote station.
#
#
#Variables for Usage
@noor-jafri
noor-jafri / deployApplication.php
Last active March 29, 2023 09:15
You can use this script to handle the Git Auto Deployment on Cloudways for any number of servers and applications using Git Webhooks.
<?php
const API_KEY = "YOUR API KEY HERE";
const API_URL = "https://api.cloudways.com/api/v1";
const EMAIL = "YOUR EMAIL GOES HERE";
/* examples
const BranchName = "master";
const GitUrl = "[email protected]:user22/repo_name.git";
*/