This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df_data = pd.read_csv("fileName.csv", sep='\t') | |
# DbImport: https://gist.github.com/Razzo78/3580cf9ed1f3c9a34484ab887b6dbf5d | |
db = DbImport("myDb.sqlite") | |
data_ins = {"filed_id": -1, | |
"filed_name": "" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import create_engine, MetaData, Table | |
from sqlalchemy.orm import mapper, sessionmaker | |
from sqlalchemy.sql import select | |
class Table1Name(object): | |
pass | |
class Table2Name(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Listview id: listView | |
for (var i = 0; i <= listView.model.count; i++){ | |
var elemCur = listView.model.get(i); | |
//Reading | |
console.log(elemCur.name); | |
//Editing | |
elemCur.name = "pippo"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ThreadToolUI::PostToMainThread(const std::function<void()> & fun) | |
{ | |
QObject signalSource; | |
QObject::connect(&signalSource, &QObject::destroyed, qApp, [=](QObject*){ | |
fun(); | |
}); | |
} | |
Task::run<void>([=]() { | |
qDebug() << "Current therad is task thread"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rxcpp::subjects::subject<int> sub; | |
auto o = sub.get_subscriber(); | |
auto source = sub.get_observable(); | |
source.subscribe( | |
[](int v) {printf("OnNext: %d\n", v); }, | |
[]() {printf("OnCompleted\n"); }); | |
o.on_next(1); | |
o.on_next(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
np.random.seed(123) | |
tails = [0] | |
for x in range(10) : | |
coin = np.random.randint(0,2) | |
tails.append(tails[x] + coin) | |
print(tails) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
step = max(0, step - 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib | |
sender = 'im@here.it' | |
receivers = ['reciver@mandi.it'] | |
message = """Ciao""" | |
smtpObj = smtplib.SMTP('smtp.gmail.com:587') | |
smtpObj.ehlo() | |
smtpObj.starttls() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import create_engine, MetaData, Table | |
from sqlalchemy.orm import mapper | |
from sqlalchemy.sql import select | |
class MyTable(object): | |
pass | |
# Trusted Connection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myList = range(1, 50) | |
concatValues = ','.join(map(str, myList)) |