This file contains hidden or 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 | |
def csv_to_excel(csv_file, excel_file): | |
df = pd.read_csv(csv_file) | |
df.to_excel(excel_file, index=False) | |
# Usage | |
csv_to_excel('data.csv', 'data.xlsx') |
This file contains hidden or 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 time | |
import datetime | |
def countdown_timer(x, now=datetime.datetime.now): | |
target = now() | |
one_second_later = datetime.timedelta(seconds=1) | |
for remaining in range(x, 0, -1): | |
target += one_second_later | |
print(datetime.timedelta(seconds=remaining), 'remaining', end='\r') | |
time.sleep((target - now()).total_seconds()) |
This file contains hidden or 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
def batch(seq, size): | |
return [ | |
seq[i:i + size] | |
for i in range(0, len(seq), size) | |
] | |
seq = [1,2,3,4,5,6] | |
size = 3 | |
# OUTPUT: [[1,2,3],[4,5,6]] |
This file contains hidden or 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
# Automate CSV | |
# pip install pandas | |
import pandas | |
# Read CSV File | |
data = pandas.read_csv("test.csv") | |
# Read CSV Specific Column | |
data = pandas.read_csv("test.csv", usecols=["col1", "col2"]) | |
# Read CSV Specific Rows | |
data = pandas.read_csv("test.csv", nrows=5) | |
# Read CSV Specific Rows and Columns |
This file contains hidden or 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
# returns the most frequent item that appears in the list: | |
def most_frequent(list): | |
return max(set(list), key = list.count) | |
numbers = [1,2,1,2,3,2,1,4,2] | |
x = most_frequent(numbers) | |
print(x) |
This file contains hidden or 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
SELECT column_name, data_type, character_maximum_length, is_nullable | |
FROM information_schema.columns | |
WHERE table_schema = 'public' AND table_name = 'platform_logs'; |
This file contains hidden or 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
{ | |
"basics": { | |
"name": "Robert L Carr", | |
"label": "", | |
"picture": "", | |
"email": "[email protected]", | |
"phone": "(650) 430-5034", | |
"website": "http://registry.jsonresume.org/rlcarrca", | |
"summary": "An accomplished hands-on technologist offering over 20 years of demonstrated career success development. Experienced in all phases of software engineering and management from concept to continuing engineering: Market requirements, technology licensing, standards, architectural and engineering specifications, resource planning, recruiting, performance evaluations, budgets, scheduling, contract negotiation, customer support, etc.. Extensive experience leading operations for Technology and Application development within a diverse range of industries. Proven ability to conceptualize and deliver complex technology solutions. Strong understanding of the relationship between technology and strategic business interests. ", | |
"location": { |
This file contains hidden or 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 __future__ import unicode_literals | |
import os | |
from bottle import route, request, static_file, run, response | |
@route('/') | |
def root(): | |
return static_file('test.html', root='.') | |
@route('/upload', method='POST') | |
def do_upload(): |
This file contains hidden or 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
def loadCommandLineArgs(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument("-r", "--regen", help="Generate reports for all dates", | |
default=False, action="store_true") | |
return parser.parse_args() |
This file contains hidden or 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/python | |
import sys | |
import ldap | |
from ldap.controls import SimplePagedResultsControl | |
from distutils.version import LooseVersion | |
# Check if we're using the Python "ldap" 2.4 or greater API | |
LDAP24API = LooseVersion(ldap.__version__) >= LooseVersion('2.4') |
NewerOlder