Skip to content

Instantly share code, notes, and snippets.

# this loads a JSON dump as for example from TWINT, and pulls out three fields, and then saves as TEXT.
import json
loadedjson = []
for line in open('TWEETS.json', 'r'):
loadedjson.append(json.loads(line))
dates = []
tweets = []
# Once you have pulled a JSON of tweets with TWINT, you can use this to plot per day.
# You need to feed it the file_to_open variable.
file_to_open = "FILENAME WITHOUT EXTENSION"
import nest_asyncio
from pandas.core.frame import DataFrame
# pandas to read our JSON/CSV file
import pandas as pd
@jonathanmc
jonathanmc / filters.js
Last active February 24, 2022 03:09 — forked from mlissner/filters.js
Regular expressions for parsing law citations from the U.S., Canada, Europe, and Australia (and probably more). Originally from the Jureeka project.
// ==UserScript==
// @name Jureeka
// @namespace http://www.jureeka.org
// @description Turns legal citations in webpages into hyperlinks that direct you to online legal source material.
// ==/UserScript==
// $Id: jureeka.js 1256 2012-02-13 19:06:16Z imad $
/*
Warnings:
@jonathanmc
jonathanmc / gist:0200607f57740ee8e0cc03154f01eb7a
Created March 23, 2022 01:25
# Python - 1. TEMPLATE including changing working dir. 2. Code scrapes all htm links on a page, put in a list, then downloads them.
# Python - 1. TEMPLATE including changing working dir. 2. Code scrapes all htm links on a page, put in a list, then downloads them.
# Python - scrape all links on a page, put in a list, then download them.
#!/usr/bin/env python3
# Change working dir
import os
project_path = '/home/WHATEVER'
try:
os.chdir(project_path)