Skip to content

Instantly share code, notes, and snippets.

View Denver-sn's full-sized avatar
💭

DℰℕVℰℛ Denver-sn

💭
View GitHub Profile
@Denver-sn
Denver-sn / nginx-subdomains.md
Created November 25, 2023 00:29 — forked from rgwozdz/nginx-subdomains.md
2 node apps on one Ubuntu EC2, access via two different subdomains

create this file:

/etc/nginx/sites-available/crp-pmte-stage.spatialdevmo.com

This file will handle visits to crp-pmte-stage.spatialdevmo.com. A Node.js app running on port 5000 needs to be served. Give the file this content:

upstream crp-pmte-stage {
    server 127.0.0.1:5000;
}
[
{
"name": "Afghanistan",
"code": "AF",
"capital": "Kabul",
"region": "AS",
"currency": {
"code": "AFN",
"name": "Afghan afghani",
"symbol": "؋"
@Denver-sn
Denver-sn / index.js
Created May 4, 2023 02:43 — forked from dmurawsky/index.js
How to make a page full height in Next.js
const FullHeightPage = () => (
<div>
Hello World!
<style global jsx>{`
html,
body,
body > div:first-child,
div#__next,
div#__next > div {
height: 100%;
// créer une fonction permettant de faire la somme de deux nombre donnés par l’utilisateur
function sum(a, b) {
return a + b;
}
// créer une fonction permettant d’afficher l’ensemble des nombres pairs entre 0 et un entier N donné par l’utilisateur
function even(n) {
for (let i = 0; i <= n; i++) {
if (i % 2 === 0) {
console.log(i);
}
@Denver-sn
Denver-sn / sample_example.py
Created December 7, 2021 00:16
Add premium / Auto remove premium Telegram Bot with PyTelegramBotAPI
# > Library
import telebot, schedule
from datetime import datetime, date
import time, sqlite3
import threading
bot = telebot.TeleBot("YOUR_TOKEN")
# > DATABASE CONNEXION
conn = sqlite3.connect('sample_database.db', check_same_thread=False)
import telebot
import sqlite3
import time
# DATABASE CONFIGURATION
conn = sqlite3.connect('sacs_db.db', check_same_thread=False)
cursor = conn.cursor()
def db_wallet(user_id: int, wallet_a: str):
cursor.execute('INSERT INTO user_db (user_id, wallet) VALUES (?, ?)',
@Denver-sn
Denver-sn / example_bot.py
Created September 17, 2021 15:49
Example pyTelegramBotAPI with SQLite3 #1
import sqlite3
import telebot
TOKEN = "<YOUR BOT TOKEN>"
bot = telebot.TeleBot(TOKEN)
# I suggest you to download SQLite Studio for creating database and tables...
conn = sqlite3.connect('database.db', check_same_thread=False) # Connecting to the database
cursor = conn.cursor()
import multiprocessing
bind = "unix:/run/app.sock" #Socket su cui deve ascoltare gunicorn
threads = multiprocessing.cpu_count() * 2 + 1
wsgi_app = "start:app" #Modulo contenente la flask app
@Denver-sn
Denver-sn / auto_refill.py
Created August 2, 2021 16:21
Bot Refill for RR (https://rivalregions.com) | For Ubuntu Server
# First configuration on Ubuntu server #
# 1- install selenium & google & chromedriver
# 2- Upload your file in the server (The bot)
# 3- type crontab -e
# 4 choose the first choice (1)
# 5- Enter 0 */2 * * * python3 /path/where/is/your_file.py
# 6- CTRL + X
# 7- type Enter and it's done!