Skip to content

Instantly share code, notes, and snippets.

View tracylemke's full-sized avatar
💭
keeping things cool

Tracy tracylemke

💭
keeping things cool
View GitHub Profile
@tracylemke
tracylemke / web-scraper-table
Created January 3, 2020 10:13
Web Scraper in Python: scrapes a table
from lxml import html
from lxml.html.clean import Cleaner
import requests
def remove_duplicates(mylist):
return list(dict.fromkeys(mylist))
cleaner = Cleaner()
@tracylemke
tracylemke / web-scraper.py
Last active December 31, 2019 09:06
Web Scraper in Python
from lxml import html
import requests
# 1. Scrape list of medical conditions
page = requests.get('https://www.nhsinform.scot/illnesses-and-conditions/a-to-z')
tree = html.fromstring(page.content)
# Scrape from this content and strip off spaces, tabs, and line breaks
# <h2 class="module__title">
# Abdominal aortic aneurysm
@tracylemke
tracylemke / gist:2522a9c9fe4096d5796d6e7011bca111
Last active February 20, 2019 10:12 — forked from esimonetti/TidewaysProf.php
POC of Tideways profiling extension for Sugar 7.9.1.0 on PHP 7.1
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// Original work: https://gist.github.com/lblockken/78a59273f2460b36eb127a7c2ee510a1
//
// 2017-07-31 on Sugar 7.9.1.0 with PHP 7.1
// filename: custom/include/SugarXHprof/TidewaysProf.php
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// 2017-11-01 tested on Sugar 7.9.1.0
// Forcing custom Sugar Cache to autoload: https://gist.github.com/esimonetti/78999f4dfbac22fd26bab8453a0ed149
//
// file: custom/Extension/application/Ext/Include/autoload_custom_redis_cache.php
SugarAutoloader::addDirectory('custom/include/SugarCache/');
@tracylemke
tracylemke / repair.php
Last active June 13, 2018 10:01 — forked from esimonetti/repair.php
Sugar CLI Repair - Instance as script argument
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// 2017-11-01 on Sugar 7.9.2.0
function usage($error = '') {
if (!empty($error)) print(PHP_EOL . 'Error: ' . $error . PHP_EOL);
print(' php ' . __FILE__ . ' --instance /full/path' . PHP_EOL);
@tracylemke
tracylemke / afterEntryPoint.php
Created November 21, 2017 05:05 — forked from esimonetti/afterEntryPoint.php
Disable Activity Stream on Sugar 7 - Application logic hook to disable writes everywhere and example of vardefs to disable module specific UI
<?php
// Enrico Simonetti
// enricosimonetti.com
// custom/logichooks/application/afterEntryPoint.php
class afterEntryPoint
{
public function disableActivityStream($event, $arguments)