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
Hello Save this to gists |
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
WITH Table_name ( | |
Table | |
,Columns | |
) | |
AS ( | |
SELECT Statement | |
) |
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
class CSOFEmail(object): | |
def __init__(self): | |
self.mail = imaplib.IMAP4_SSL('outlook.office365.com', port='993') | |
self.mail.login('[email protected]', 'Hardcore8*') | |
print("logged in") | |
self.folder_info = defaultdict(dict) | |
def grab_folder_list(self): | |
response, dir_list = self.mail.list(directory='INBOX/CSOF.NET/') |
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 urllib.request import urlopen # python 3 syntax |
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
"""splits a large text file into smaller ones, based on line count | |
Original is left unmodified. | |
Resulting text files are stored in the same directory as the original file. | |
Useful for breaking up text-based logs or blocks of login credentials. | |
""" |
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 BeautifulSoup import BeautifulSoup | |
def _remove_attrs(soup): | |
for tag in soup.findAll(True): | |
tag.attrs = None | |
return soup | |
def example(): | |
doc = '<html><head><title>test</title></head><body id="foo" onload="whatever"><p class="whatever">junk</p><div style="background: yellow;" id="foo" class="blah">blah</div></body></html>' |
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
public class WebClientEx : WebClient | |
{ | |
private CookieContainer _cookieContainer = new CookieContainer(); | |
protected override WebRequest GetWebRequest(Uri address) | |
{ | |
WebRequest request = base.GetWebRequest(address); | |
if (request is HttpWebRequest) | |
{ | |
(request as HttpWebRequest).CookieContainer = _cookieContainer; |
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
<configuration> | |
<system.diagnostics> | |
<sources> | |
<source name="System.Net.Sockets" tracemode="protocolonly"> | |
<listeners> | |
<add name="System.Net.Sockets" type="System.Diagnostics.TextWriterTraceListener" initializeData="network.log" /> | |
</listeners> | |
</source> | |
</sources> |
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 tqdm import tqdm | |
from time import sleep | |
import pandas as pd | |
mycsv = "C:\\Users\\rob\\Downloads\\contest-standings-17968412\\contest-standings-17968412.csv" | |
mycsv2 = "C:\\Users\\rob\\Downloads\\contest-standings-17968412\\testEmail.csv" | |
# items = range(1,100) | |
# |
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
#!/usr/bin/env python | |
""" | |
simple mssql -> csv file example using pymssql | |
@author [email protected] | |
""" | |
import csv | |
import datetime | |
import pymssql | |
from decimal import Decimal |
OlderNewer