Skip to content

Instantly share code, notes, and snippets.

Hello Save this to gists
WITH Table_name (
Table
,Columns
)
AS (
SELECT Statement
)
class CSOFEmail(object):
def __init__(self):
self.mail = imaplib.IMAP4_SSL('outlook.office365.com', port='993')
self.mail.login('rsmith@freshaddress.com', 'Hardcore8*')
print("logged in")
self.folder_info = defaultdict(dict)
def grab_folder_list(self):
response, dir_list = self.mail.list(directory='INBOX/CSOF.NET/')
# from urllib.request import urlopen # python 3 syntax
"""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.
"""
@robsmith1776
robsmith1776 / kill_attrs.py
Created November 19, 2015 16:36 — forked from bradmontgomery/kill_attrs.py
A way to remove all HTML attributes with BeautifulSoup
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>'
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;
<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>
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)
#
@robsmith1776
robsmith1776 / mssql_to_csv.py
Created February 26, 2016 00:33 — forked from tinybike/mssql_to_csv.py
simple mssql -> csv file example using pymssql
#!/usr/bin/env python
"""
simple mssql -> csv file example using pymssql
@author jack@tinybike.net
"""
import csv
import datetime
import pymssql
from decimal import Decimal