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
#Install-Module dbatools | |
#In case of scripts are disabled, run first : | |
#powershell -noprofile -ExecutionPolicy bypass | |
import-module dbatools; | |
Get-ChildItem -Path "C:\CSV_PATH" | ForEach-Object { | |
Import-DbaCsv -Csv $_.FullName -SQLInstance "DESKTOP-C5EUKT9" -Database "stagging" -AutoCreateTable |
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
def most_commons(List): | |
"""Return a new list with the most common elements | |
in a list | |
""" | |
from collections import Counter | |
count = Counter(List) | |
freq_list = count.values() | |
max_cnt = max(freq_list) | |
total = freq_list.count(max_cnt) | |
most_commons = count.most_common(total) |
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
# Source : https://pythonprogramminglanguage.com/logistic-regression-spam-filter/ | |
# dataset : https://archive.ics.uci.edu/ml/datasets/SMS+Spam+Collection | |
import pandas as pd | |
import numpy as np | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from sklearn.linear_model.logistic import LogisticRegression | |
from sklearn.model_selection import train_test_split, cross_val_score | |
df = pd.read_csv(r'C:/Users/student/Desktop/spam detect logistic regression python/SMSSpamCollection', delimiter='\t',header=None) |
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
import urllib | |
import urllib2 | |
import json | |
url = 'https://api.monkeylearn.com/v3/classifiers/cl_pi3C7JiL/classify/' | |
headers = { |
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
import os | |
CHROME_PATH = r"/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome" | |
url = "https://www.tidytextmining.com/tfidf.html" | |
def url_to_pdf(url, filename): | |
chrome_args = [CHROME_PATH, |
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 python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Import the content of each files in a folder in a unique csv | |
where each row contains the content of a file | |
Arguments: | |
-i or --inputfolder : path to the folder containing the files |
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 | |
#-*- coding: utf-8 -*- | |
""" | |
Script destiné à scraper les noms de cabinettards sur le vieux site au HTML très pourri de 4instance | |
""" | |
# J'importe les modules externes qui seront nécessaires | |
# A installer au préalable en ligne de commandes (ou dans le terminal de VSCode) | |
# exemple : pip install bs4 ; pip install requests ; pip install pandas ; pip install regex |
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 | |
import csv | |
from pymarc import MARCReader | |
from os import listdir | |
from re import search | |
# change this line to match your folder structure | |
SRC_DIR = '/path/to/mrc/records' |
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 python3 | |
# -*- coding: utf-8 -*- | |
import os | |
import requests | |
from bs4 import BeautifulSoup | |
import glob | |
from PyPDF2 import PdfFileMerger | |
#Todo: debug this function |
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 perl | |
# | |
# Match authors against VIAF | |
# | |
# License: http://dev.perl.org/licenses/artistic.html | |
# | |
# Author: Patrick Hochstenbach <[email protected]> | |
# | |
# Apr 2015 | |
$|++; |
NewerOlder