Skip to content

Instantly share code, notes, and snippets.

@vitorgalvao
vitorgalvao / Get Title and URL.applescript
Last active December 10, 2024 01:34
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Webkit variants include "Safari", "Webkit", "Orion".
-- Specific editions are valid, including "Safari Technology Preview".
-- "Safari" Example:
tell application "Safari" to return name of front document
@vivekseth
vivekseth / free-read
Created October 28, 2014 21:54
Bypass Paywall on Most Websites (Bookmarklet)
/**
BOOKMARKLET IS AT BOTTOM OF COMMENT
Many paywalled websites like the New York Times disable their paywall when you access their content from social media or google. News websites want you to pay for their content, but they don't want to block traffic from search engines and social media because that would kill a large chunk of their traffic.
If you encounter a paywall when trying to view an article, all you need to do is find that article via google and click on the link from there. The paywall will be disabled and you will be able to view the article unfettered.
This bookmarklet streamlines that process. It scrapes the URL of the article for a unique identifier and searcesh google for that identifier. Google likely throw back the article you wanted to view as one of the top search results.
** Attention NYT and Others **
{
"status": "200",
"payload": [
{
"title": "Nobis voluptatem ipsa fugit dolor cumque.",
"body": "Iusto ex vel mollitia aliquid. Voluptas perferendis sunt. Inventore tempore ea dolor repellat fugiat et voluptatem. Culpa reiciendis quia ratione illo cupiditate.",
@melgor
melgor / sompy_1.ipynb
Last active May 5, 2018 11:12
SOMPY Tutorial 1 Refactored
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vivekseth
vivekseth / sompy_1.ipynb
Created April 20, 2016 15:37 — forked from melgor/sompy_1.ipynb
SOMPY Tutorial 1 Refactored
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simonw
simonw / recover_source_code.md
Last active September 28, 2024 08:10
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
// gif by dave @beesandbombs :)
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {