recentpopularlog in

@read

« earlier   
Sanitize HTML with Beautiful Soup
If you have a website that displays user-generated HTML (emails, rich text entry, etc), you likely want to scrub that HTML before you display it. At the very least, you want to provide a reasonable protection against XSS. But maybe you also want to prevent the HTML from breaking your page layout. Either way, Beautiful Soup is a good tool for the job.

Here is some Python code that uses Beautiful Soup to clean HTML of any tags and attributes not explicitly white listed. The CSS property scrubbing is blacklist based, which sucks and should be redone with a real CSS parsing library.
@read 
8 hours ago by will.brien
Extracting text from HTML file using Python - Stack Overflow
The best piece of code I found for extracting text without getting javascript or not wanted things :

import urllib
from bs4 import BeautifulSoup

url = "http://news.bbc.co.uk/2/hi/health/2284783.stm"
html = urllib.urlopen(url).read()
soup = BeautifulSoup(html)

# kill all script and style elements
for script in soup(["script", "style"]):
script.extract() # rip it out

# get text
text = soup.get_text()

# break into lines and remove leading and trailing space on each
lines = (line.strip() for line in text.splitlines())
# break multi-headlines into a line each
chunks = (phrase.strip() for line in lines for phrase in line.split(" "))
# drop blank lines
text = '\n'.join(chunk for chunk in chunks if chunk)

print(text)
@read 
8 hours ago by will.brien
python - AttributeError: 'module' object has no attribute 'urlopen' - Stack Overflow
To get 'dataX = urllib.urlopen(url).read()' working in python3 (this would have been correct for python2) you must just change 2 little things.

1: The urllib statement itself (add the .request in the middle):

dataX = urllib.request.urlopen(url).read()

2: The import statement preceding it (change from 'import urlib' to:

import urllib.request

And it should work in python3 :)
@read 
8 hours ago by will.brien
Import & Export Cygwin List of installed Packages
Thanks for putting up these instructions, was a real time saver for helping me keep multiple Cygwin installations up-to-date. Modified the process slightly, I made a shell script to generate a batch file that runs setup-x86_64.exe with all the package files. No AWK or Python required on the target system where I want to install Cygwin:

#!/bin/sh
echo -n "setup-x86_64.exe -P " > update.bat
cygcheck -c -d | sed -e "1,2d" -e 's/ .*$//' | awk 'NR==1{printf \$1}{printf ",%s", \$1}' >> update.bat

You can change that to pass additional parameters to setup, such as doing a silent install or specifying the location of a local install directory etc. Hope that helps someone!
@read 
13 hours ago by will.brien
NoSquint Plus :: Add-ons for Firefox
Having a hard time reading on the web? Is that website with the ridiculously small font and hot-pink-on-slightly-darker-hot-pink text raising your blood pressure?

NoSquint Plus is a Firefox addon that can:

Override the default text-only and full-page (both text and images) zoom levels for all websites
Enforce your own foreground and background colors
Remember your zoom levels and color settings per site, automatically applying them when you return.
A powerful exceptions mechanism lets you split up or group together sites with URL patterns.


Right click on a web page to get “NoSquint Plus Site Settings” context menu option to tweak settings for a specific site. Global Settings button is also placed in Site Settings panel to tweak options globally for all sites.
@read 
14 hours ago by will.brien
Use RSS with YouTube - YouTube Help
Get RSS updates for all subscriptions

To import all your YouTube subscriptions to your RSS reader, you can use our OPML file download feature:

Download the OPML file by clicking Export subscriptions at the bottom of your Manage Subscriptions page. This will download a file named "subscription_manager.xml".
Import the OPML file in your RSS reader.
In Feedly, for example, this can be found in Organize in the left panel, then Import OPML.
@read 
14 hours ago by will.brien
Jock-of-all-Trades: How to change a tap washer
These washers are very cheap and are as widely available as fuses for plugs. You can probably get one from your nearest hardware-store or mini-DIY stockist, where you can buy them in small packets, or from a plumbing shop where they can usually be bought individually.

Washers for sink-taps are generally 1/2 inch, while bath tap washers are generally 3/4 inch.
@read 
16 hours ago by will.brien
Bookmarklets context menu :: Add-ons for Firefox
In Firefox bookmarklets are executed as author's script.
But should be executed as user's scripts (with higher pivileges).
This why it's impossible to execute bookmarklets on website that use a strict CSP.

This extension execute bookmarklets as content script (privileged context). This allow to make cross-origin requests, write to the clipboard, communicate with addons, etc.

Note: CSP still applied on subresources (dependencies). That means with a super strict CSP "none", you can't use other scripts, styles nor medias
@read 
16 hours ago by will.brien
About | ESB Archives
ESB Archives collects, preserves and makes accessible records relating to ESB.

Our collections reflect the unique contribution of ESB to the economic and social development of Ireland over the past 90 years and includes:

Shannon Scheme Development
Rural Electrification
Development of Stations
Marketing and promotional material
Audio visual material including photographs, film and oral histories

The archives team are busy cataloguing and continuing to make accessible further archive collections. New content will be posted regularly through updates on our blog.
@read 
16 hours ago by will.brien
Mastodon 2.0 – Eugen Rochko – Medium
It’s also worth mentioning that the central resource for the Mastodon project is now the joinMastodon.org website, which explains the benefits of decentralization, links to all related resources, lists the project’s sponsors, and most importantly, provides an overview of the existing network. If you want to tell someone about Mastodon, you’ve got two options now— invite them over to the instance you’re using, or link them to joinMastodon.org where they’ll pick one on their own.
@read 
16 hours ago by will.brien
Modern JavaScript Explained For Dinosaurs – Peter Jang – Medium
The goal of this article to to provide a historical context of how JavaScript tools have evolved to what they are today in 2017. We’ll start from the beginning and build an example website like the dinosaurs did — no tools, just plain HTML and JavaScript. Then we’ll introduce different tools incrementally to see the problems that they solve one at a time. With this historical context, you’ll be better able to learn and adapt to the ever-changing JavaScript landscape going forward. Let’s get started!
@read 
3 days ago by will.brien
python - extracting text from multiple urls - Stack Overflow
I'd like to replicate the process so I can extract text from hundreds of URLs. Is there a way to set this up so I can enter a list of URLs, extract text, and then (my guess) I could join them together for NLP or whatever else I want to do? Thanks in advance...
@read 
4 days ago by will.brien
Better With Age: Does Cannabis Ease Menopause Symptoms?
Low estrogen levels during and after menopause may have a huge impact on your mood. As mentioned earlier, estrogen rounds up endocannabinoids to help maintain mood and reduce anxiety. Yet, when your estrogen levels drop, what’s left to trigger these molecules into action?

As always, more research is needed. Yet, we do know that there is strong evidence that cannabinoid therapy may boost mood. Where can you find supplemental cannabinoids? In cannabis.

Both THC and cannabidiol (CBD) have mood-lifting properties. In low doses, THC is a potent antidepressant. Nonpsychoactive CBD has been found to be an extremely fast-acting antidepressant in animal models. It also is a powerful anxiolytic. CBD can even help calm down anxiety produced by THC.
@read 
4 days ago by will.brien
Newspaper on Python
Newspaper is an excellent Python module used for extracting and parsing newspaper articles. I took the module for a very quick test drive today and wanted to document my initial findings, primarily as an aide memoir.
@read 
4 days ago by will.brien
How To Install Node.js on Debian 8 | DigitalOcean
In this guide, you'll install Node.js on a Debian 8 server. Debian 8 contains a version of Node.js in its default repositories, but this version is outdated, so you'll explore two methods to install the latest version of Node.js on your system.
@read 
4 days ago by will.brien
Will Tom Thibodeau overwork the Timberwolves?
In April 2016, Thibodeau accepted a job with the Minnesota Timberwolves to be the president of basketball operations and head coach, in charge of leading the youthful talents of Karl-Anthony Towns, Andrew Wiggins and Zach LaVine. In announcing the hire, Timberwolves owner Glen Taylor called Thibodeau "the best leader to shape our talented team and help them realize their full potential."

And just like that, Minnesota became the NBA's hottest up-and-coming team, even earning a highly coveted spot on the NBA's Christmas Day lineup. The Timberwolves were the darling of the NBA.com's annual GM preseason survey. Most improved team? Minnesota. Rookie of the Year? Minnesota's Kris Dunn. Coach with best defensive schemes? Thibodeau. Which new coach will make the biggest impact? Seventy-eight percent tabbed Thibs.

And then reality set in.
@read 
4 days ago by will.brien
How to set up world-class continuous deployment using free hosted tools
I’m going to describe a way to put together a world-class continuous deployment infrastructure for your side-project without spending any money.

With continuous deployment every code commit is tested against an automated test suite. If the tests pass it gets deployed directly to the production environment! How’s that for an incentive to write comprehensive tests?

Each of the tools I’m using offers a free tier which is easily enough to handle most side-projects. And once you outgrow those free plans, you can solve those limitations in exchange for money!
@read 
5 days ago by will.brien
New Zealand’s Neoliberal Drift
Through the 1980s and 1990s — first under Labour, then under National Party rule — New Zealand ushered in neoliberal reform on an unprecedented scale. Controls on wages, prices, rents, interest rates, and more were scrapped. Finance markets were deregulated, and restrictions on foreign investment were removed or relaxed. Based on the belief that welfare helped create unemployment by encouraging dependency, the system was overhauled in ways that the government’s own official encyclopedia describes as “particularly swift and severe.”

In 1986, Labour slashed the tax rate for high-income earners and introduced a goods-and-services tax. This change effectively hiked taxes on low- and middle-income earners, given that they spend a larger proportion of their earnings on consumption. (Douglas even tried to institute a flat tax, which turned out to be a step too far for Labour.) Legislation in 1991 eliminated hard-fought reforms like compulsory union membership, compulsory employer-employee bargaining, and unions’ special place in this process.

Most state-owned assets were fully or partially sold off, including three banks, the Tower insurance company, shipping companies, the national airline and the country’s main airport, and various energy companies, among many others. In some cases, the results were disastrous, as when National sold off the country’s highly profitable national rail network to a consortium of financial companies, who soon ran it into the ground, forcing a government buyback. It wasn’t the only privatized asset the government later had to rescue.

Government disinvestment from public services abandoned the most vulnerable citizens. Nearly all psychiatric hospitals closed down by the 1990s, their responsibilities passing on to nongovernmental organizations. University tuition fees shot up by nearly 1,000 percent in 1990 and have climbed steadily ever since. The price of attending college in New Zealand now ranks as the industrial world’s fourth highest. The abrupt end of farm subsidies and protectionist policies hit farmers hard, plunging them into debt and leading to a spate of suicides. One prominent Kiwi recalled seeing a beggar on the streets of New Zealand for the first time in his mid-fifties, an experience he described as “like being kicked in the stomach.”

All of this happened at a dizzying pace. And it had to because the reforms were hugely unpopular.

“It is uncertainty, not speed, that endangers the success of structural reform programs,” wrote Roger Douglas in 1993. “Speed is an essential ingredient in keeping uncertainty down to the lowest possible level.” Douglas would later reportedly advise foreign leaders to keep their equivalent programs hidden from the public and to implement them as quickly as possible to bypass opposition.
@read 
5 days ago by will.brien
Goodbye Uncanny Valley on Vimeo
It’s 2017 and computer graphics have conquered the Uncanny Valley, that strange place where things are almost real... but not quite. After decades of innovation, we’re at the point where we can conjure just about anything with software. The battle for photoreal CGI has been won, so the question is... what happens now?
@read 
5 days ago by will.brien
A Letter to Jamie Dimon – Chain
Let me start by stating that I believe:

The market for cryptocurrencies is overheated and irrationally exuberant
There are a lot of poseurs creating them, and some scammers, too
There are a lot of conflicts of interest, self-serving hype, and obfuscation
Very few people in the media understand what’s going on
Very few people in finance understand what’s going on
Very few people in technology understand what’s going on
Very few people in academia or government understand what’s going on
Very few people buying cryptocurrencies understand what’s going on
It’s very possible I don’t understand what’s going on

Also:

Banks and governments aren’t going away
Traditional software isn’t going away

In short: there’s a lot of noise. But there is also signal. To find it, we need to start by defining cryptocurrency.
@read 
5 days ago by will.brien

Copy this bookmark:





to read