Skip to content

Instantly share code, notes, and snippets.

View attibalazs's full-sized avatar
🌱
Ficus

Atti attibalazs

🌱
Ficus
View GitHub Profile
@attibalazs
attibalazs / Recipes - Entity Extraction.ipynb
Created April 6, 2018 15:29 — forked from psychemedia/Recipes - Entity Extraction.ipynb
Examples of tagging and fuzzy matchings items in txt docs using python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@attibalazs
attibalazs / gist:d4c0f9a1d21a0b24ff375690fbb9f9a7
Last active January 13, 2023 09:46
Python functions for creating outlook data files .pst files for archiving emails using win32com.client
# code based on https://mail.python.org/pipermail/python-list/2015-November/698551.html
def find_pst_folder(mapi, pst_filepath):
dispatch = win32com.client.gencache.EnsureDispatch
for store in dispatch(mapi.Stores):
if store.IsDataFileStore and store.FilePath == pst_filepath:
return store.GetRootFolder()
def get_pst_folder(pst_filepath):
@attibalazs
attibalazs / Oracle_get_all_dependencies.sql
Created February 21, 2017 15:21
Get all dependencies for oracle table or view. A hierarchical query which goes through the dependency tree.
select distinct *
from all_dependencies a
start with a.referenced_name = 'TEST'
connect by NOCYCLE prior a.name = a.referenced_name;
@attibalazs
attibalazs / gist:10ad28464415ac4f62f1d263d798eca3
Created October 7, 2016 14:55 — forked from drorata/gist:146ce50807d16fd4a6aa
Minimal Working example of Elasticsearch scrolling using Python client
# Initialize the scroll
page = es.search(
index = 'yourIndex',
doc_type = 'yourType',
scroll = '2m',
search_type = 'scan',
size = 1000,
body = {
# Your query's body
})
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# shortform git commands
alias g='git'
# git commit random alias
git config --global alias.commit-random '!git commit -m "$(curl -s http://whatthecommit.com/index.txt)"'
usage: git commit-random
# get list of users public repos
curl "https://api.github.com/users/usernamehere/repos?type=owner&sort=updated" -s | sed -En 's|"name": "(.+)",|\1|p' | tr -d ' '
@attibalazs
attibalazs / file_list.py
Created May 5, 2016 13:41
Python script to do a file listing and log basic attributes to a csv file
import sys, os, time, csv
data_dir = os.path.join(os.getcwd(), os.pardir, 'data')
sys.path.append(data_dir)
with open(os.path.join(data_dir, "listing.csv"), 'w') as csvfile:
writer = csv.writer(csvfile)
row = ('path', 'modified_date', 'last_accesed_date', 'size')
writer.writerow(row)
for root, directories, filenames in os.walk('c:\\temp\\'):
for filename in filenames:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# how can i exclude None values ?
#get minimum and maximum stock options
result = min(data_dict.values(), key=lambda v:v['exercised_stock_options'] if v['exercised_stock_options'] != 'NaN' else float('inf'))
print result
result = max(data_dict.values(), key=lambda v:v['exercised_stock_options'] if v['exercised_stock_options'] != 'NaN' else float('-inf'))
print result