Controlling Screen Brightens using C Programing for Windows OS
Introduction:
Understanding Gamma Ramp:
Windows API Functions:
#include <windows.h>void SetBrightness(WORD brightness) {HDC hdc = GetDC(0);if (hdc != NULL) {WORD gammaRamp[3][256];for (int i = 0; i < 256; i++) {gammaRamp[0][i] = gammaRamp[1][i] = gammaRamp[2][i] = (WORD)(i * brightness / 255);}SetDeviceGammaRamp(hdc, gammaRamp);ReleaseDC(0, hdc);}}
Adjusting Screen Brightness:
int main() {// Set brightness to a value between 0 and 255SetBrightness(150); // Adjust the value as neededreturn 0;}
Conclusion:
How to install VSCode on Cloud
$(function() {
alert('I am using Prettify as Syntax Highlighter');
});
How to create SWAP Space
Deploy Algorithmic Trading Strategy: SSH into VM Instance | Part 4
Algorithmic Trading - Create an VM Instance
Setup Always free VPS Server
Welcome back to our series on Setting up Your Live Algorithmic Trading Environment from Scratch! In this second video of the series, we'll be showing you how to set up an always free virtual private server (VPS) on your preferred cloud provider.
An always free VPS is an excellent option for anyone looking to set up a reliable, cost-effective trading environment. In this video, we'll cover the steps required to set up your always free VPS, including how to select your preferred operating system and configure your settings for optimal performance.
By the end of this video, you'll have a fully functional VPS server up and running, ready for use in your algorithmic trading environment. Be sure to watch the next video in our series, where we'll cover how to create and configure a virtual machine (VM) instance on your new VPS server.
Thanks for watching, and don't forget to like, comment, and subscribe to our channel for more algorithmic trading tutorials and tips!
Setting up Your Live Algorithmic Trading Environment from Scratch, p1: Why Cloud?
How to Deploy Django with Nginx Gunicorn and Supervisor on Ubuntu 22.04
Learn how to deploy a Django application with Nginx, Gunicorn, and Supervisor on Ubuntu 22.04. Get step-by-step instructions for setting up a secure, reliable web server using best practices that will help you keep your web application.
Create Separate User and Group
sudo groupadd --system project-group
Add New User
sudo useradd --system --gid project-group --shell /bin/bash --home/projectroot project-user
Create a Root Folder for the project
mkdir ~/projectroot
cd ~/projectroot
Then create a virtual environment for the Project
virtualenv app1
Go to the environment folder and activate the virtual environment
cd app1
source bin/activate
Create the requirements.txt file for the Django or flask project
sudo vi requirements.txt
Add the packages then save the file.
Create a log folder in the environment folder
mkdir logs
Now clone the Django or flask project from the GitHub repository
git clone url.git
change the ownership permission for the project and other files
sudo chown -R project-user:project-group .
Create a gunicorn script in bin folder
sudo vi bin/gunicorn_start
Paste the below script into the file
#!/bin/shNAME='Project Name'DJANGODIR=/projectroot/app1/django_projectSOCKFILE=/projectroot/app1/run/gunicorn.sockUSER=project-groupGROUP=project-userNUM_WORKERS=3DJANGO_SETTINGS_MODULE=django_project.settingsprodDJANGO_WSGI_MODULE=django_project.wsgiTIMEOUT=120cd $DJANGODIRsource ../bin/activateexport DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULEexport PYTHONPATH=$DJANGODIR:$PYTHONPATHRUNDIR=$(dirname $SOCKFILE)test -d $RUNDIR || mkdir -p $RUNDIRexec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \--name $NAME \--workers $NUM_WORKERS \--timeout $TIMEOUT \--user=$USER --group=$GROUP \--bind=unix:$SOCKFILE \--log-level=debug \--log-file=-
then make this file Executable
chmod +x bin/gunicorn_start
Now install the Supervisor
sudo apt install supervisor
Create a new config file in the supervisor
sudo vi /etc/supervisor/conf.d/django_project.conf
then add the below script and save
[program:django_project]command = /projectroot/app1/bin/gunicorn_startuser = project-userstdout_logfile = /projectroot/app1/logs/supervisor.logredirect_stderr = trueenvironment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8
supervisorctl rereadsupervisorctl updatesupervisorctl status
Now create the nginx configaration for the project
sudo vi /etc/nginx/sites-available/django_project.conf
paste the below configaration.
upstream django_project_app_server {server unix:/saulroot/saul_3_6_4/run/gunicorn.sock fail_timeout=0;}server {listen 80;server_name example.com;access_log /projectroot/app1/logs/nginx-access.log;error_log /projectroot/app1/logs/nginx-error.log;location /static/ {alias /projectroot/app1/django_project/static/;}location /media/ {alias /projectroot/app1/django_project/media/;}location / {proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header Host $http_host;proxy_redirect off;if (!-f $request_filename) {proxy_pass http://django_project_app_server;}}}
Restart Nginx
sudo nginx -tsudo systemctl restart nginx
open the browser http://example.com