Skip to content

Instantly share code, notes, and snippets.

@sansal54
sansal54 / Flask + Nginx konfigürasyonu
Last active May 11, 2020
Flask + Nginx konfigürasyonu
View Flask + Nginx konfigürasyonu
Assuming flask app is running on http://localhost:5000 with gunicorn and supervisor already setup.
# install nginx and dependencies
$ sudo apt-get install python3-dev nginx
create a new server block configuration file in Nginx’s sites-available directory named cafe_app13:
$ sudo nano /etc/nginx/sites-available/cafe_app13
Open up a server block and tell Nginx to listen on the default port 80. We also need to tell it to use this block for requests for our server’s domain name or IP address:
View gist:7bf565a30059b0f2053a3b3fa8bc1977
Get chat id from Telegram bot
1- Add the bot to the group.
Go to the group, click on group name, click on Add members, in the searchbox search for your bot like this: @my_bot, select your bot and click add.
2- Send a dummy message to the bot.
You can use this example: /my_id @my_bot
(I tried a few messages, not all the messages work. The example above works fine. Maybe the message should start with /)
@sansal54
sansal54 / quote.dart
Created Dec 9, 2019 — forked from mjohnsullivan/quote.dart
Simple Flutter app to retrieve and display a quote of the day
View quote.dart
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@sansal54
sansal54 / Rpi-InfluxDB-Install.md
Created Oct 8, 2019 — forked from boseji/Rpi-InfluxDB-Install.md
Raspberry Pi InfluxDB installation
View Rpi-InfluxDB-Install.md

Raspberry Pi InfluxDB: The solution for IoT Data storage

Raspberry Pi is costeffect linux computer very commonly used for IoT home automation projects.

Here are the 3 problems with conventional databases for IoT data store applications:

  • Too much or complex configuration
  • Unable to expire data / set retentional policies
  • Not tailor made of Time Series Data
@sansal54
sansal54 / spellnumber.vba
Created Sep 21, 2019
Convert Currency Numbers into Text #excel #vba #macro
View spellnumber.vba
Option Explicit
'Main Function
Function SpellNumber(ByVal MyNumber)
Dim Dollars, Cents, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " Bin "
Place(3) = " Milyon "
Place(4) = " Milyar "
Place(5) = " Trilyon "
View send message to telegram.py
import urllib.request
# Generate a bot ID here: https://core.telegram.org/bots#botfather
token = "822598813:AAHfVAjmDU3A6AgLpzbMEVImseo6a9HV5qo"
sansal_chat_id = "595115128"
kadir_chat_id = "936825399"
mymessage = "mesaj123"
url = "https://api.telegram.org/bot822598813:AAHfVAjmDU3A6AgLpzbMEVImseo6a9HV5qo/sendMessage?chat_id=595115128&text=Sansal"
View omegaPID.py
import PID
import time
import os.path
from OmegaExpansion import AdcExp
from OmegaExpansion import pwmExp
pwmExp.setVerbosity(-1)
pwmExp.driverInit()
adc = AdcExp.AdcExp()
@sansal54
sansal54 / poll_modbus_2_influxdb.py
Created Jan 21, 2017
InfluxDb Example with Modbus Room Thermostat in Python
View poll_modbus_2_influxdb.py
import os
import sys
import time
import datetime
import minimalmodbus
from influxdb import InfluxDBClient
minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL=True
PORT_NAME = 'com7'
You can’t perform that action at this time.