Skip to content

Instantly share code, notes, and snippets.

View exemplum100's full-sized avatar
🐒
Focusing

exemplum100

🐒
Focusing
View GitHub Profile
@exemplum100
exemplum100 / pyOutlookRemind.py
Created September 5, 2023 14:36
pyOutlookRemind
#How it work
#:Search info in incoming messages and remind about new value, into Outlook from third-system, without last(closed) selfstatus
#:Last selfstatus substitution in closed_list.txt manualy
#:Make txt file with some info, for reminder button
#:After, remind about new messages
#(foxes in comment just for ex)
import os
import time
from datetime import datetime
import win32com.client as win32
@exemplum100
exemplum100 / silent.txt
Created September 5, 2023 14:35
silentexecPYW
--Task sheduler
week,workday,12 min, in 12hours
--silent.vms
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c C:\Users\Desktop\Folder\shedule.bat", 0, false
--shedule.bat
@echo off
cd "C:\Users\Desktop\Folder\"
start pyw mypyfile.pyw
exit
@exemplum100
exemplum100 / ValFromTableList.sql
Last active July 16, 2023 13:14
Cursor Sample, declare for tables list. Result select values from list of tables, with equal(!) column names
--Cursor Sample, declare for tables list--
--Result select val from list of tables, with equal column names--
IF OBJECT_ID('tempdb..#connector1') IS NOT NULL DROP TABLE #connector1
IF OBJECT_ID('tempdb..#resulttable') IS NOT NULL DROP TABLE #resulttable
CREATE TABLE #connector1 (val int)
CREATE TABLE #resulttable (id int, val int)
DECLARE
@exemplum100
exemplum100 / SQLquote.py
Created July 16, 2023 09:45
Quote data to sql something
# simple quote val
# exmpl: '1000000000','2222222','333333333'
x='''10000000000000000000
222222222222222222222
3333333333333333333
4444444444444444444444
55555555555555555555555
'''
def formz(x):
y=x.rstrip().replace('\n','\',\'') # '\n','\',\'' '\n',','
@exemplum100
exemplum100 / SQLinsertd.py
Created July 16, 2023 09:44
Formatting to insert
# data for insert only one column
# ex: ('248957'),('248959'),('248960'),('248961'),('248962')
x='''248957
248959
248960
248961
248962
248963
248964
552416
@exemplum100
exemplum100 / SendZipByOutlook.py
Created July 16, 2023 09:11
Send file by outlook
import os
import shutil
import pprint
from datetime import datetime
import win32com.client as win32
#upd stamp
with open("lastupd.txt", "a") as f:
x = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
f.write(x + '\n')
@exemplum100
exemplum100 / zipdir.py
Created July 16, 2023 09:10
Zip something
import os
import shutil
import pprint
from datetime import datetime
#upd stamp
with open("lastupd.txt", "a") as f:
x = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
f.write(x + '\n')
@exemplum100
exemplum100 / outl.py
Last active April 5, 2024 16:53
Py+Outlook
import os
import win32com.client as win32
olApp = win32.Dispatch('Outlook.Application')
olNS = olApp.GetNameSpace('MAPI') # NameSpaces need for attchm
mailItem = olApp.CreateItem(0)
mailItem.Subject = 'Dummy Email2'
mailItem.BodyFormat = 1
mailItem.Body = "Hello World"
@exemplum100
exemplum100 / postgist.py
Created July 16, 2023 07:32
Gists update
import requests
import json
GITHUB_API="https://api.github.com"
API_TOKEN = config.token
#
a = []
x=open(config.discr, 'r')
@exemplum100
exemplum100 / geography_point.sql
Created July 16, 2023 07:32
Использование типа GEOGRAPHY для adhoc отчета
DECLARE geo_kursor CURSOR LOCAL FOR
SELECT k.pin,k.lat,k.long,k.geo,k.reciv FROM #koors3 AS k
ORDER BY k.reciv
OPEN geo_kursor
FETCH NEXT FROM geo_kursor
INTO @pinfirst,@latg,@longg,@geocurs,@receiv ---LOOK
WHILE @@FETCH_STATUS=0
BEGIN
SET @userloc = geography::Point(@latg, @longg, 4326).STBuffer(@km)
SET @checkgeo1 = (SELECT TOP (1) t.checkgeo FROM #t2 AS t WHERE t.checkpin=@pinfirst ORDER BY t.receivedm DESC )