This file contains hidden or 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
from warcio.capture_http import capture_http | |
import requests | |
from bs4 import BeautifulSoup | |
from urllib.parse import urlparse | |
import os | |
import sqlite3 | |
import datetime | |
import sys |
This file contains hidden or 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
from datasette.database import Database | |
from datasette import hookimpl | |
from datasette.utils.asgi import Response | |
import os | |
` | |
async def reload_db(datasette): | |
spec = datasette.plugin_config('datasette-reload-db') | |
db_dir = os.listdir(spec['dir']) | |
databases = datasette.databases |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains hidden or 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
Datum;Förband;Förband klartext; | |
1926-07-07;653;Östgöta flygflottilj (F 3); | |
1926-07-08;653;Östgöta flygflottilj (F 3); | |
1926-07-28;652;Roslagens flygkår (F 2); | |
1926-08-09;652;Roslagens flygkår (F 2); | |
1926-08-15;653;Östgöta flygflottilj (F 3); | |
1926-08-20;652;Roslagens flygkår (F 2); | |
1926-08-20;652;Roslagens flygkår (F 2); | |
1926-08-20;653;Östgöta flygflottilj (F 3); | |
1926-09-24;653;Östgöta flygflottilj (F 3); |
This file contains hidden or 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 hashlib | |
import optparse | |
from os import walk | |
from os.path import dirname, isfile, join, relpath,basename | |
HASH_BLOCK_SIZE = 65536 | |
def hash_file(fname, dig): | |
if dig == "sha256": |
This file contains hidden or 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
ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4 |
This file contains hidden or 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
-- Reasonably efficient pagination without OFFSET | |
-- SQLite version (Adapted from MS SQL syntax) | |
-- Source: http://www.phpbuilder.com/board/showpost.php?p=10376515&postcount=6 | |
SELECT foo, bar, baz, quux FROM table | |
WHERE oid NOT IN ( SELECT oid FROM table | |
ORDER BY title ASC LIMIT 50 ) | |
ORDER BY title ASC LIMIT 10 |
This file contains hidden or 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 csv | |
delimiter = ',' | |
delimiter_number = 3 | |
import logging | |
errors = 0 | |
logging.basicConfig(filename='file.log', level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s") | |
with open('deniro.csv', 'r') as csvfile: |
This file contains hidden or 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 string | |
import unicodedata | |
valid_filename_chars = "-_.() %s%s" % (string.ascii_letters, string.digits) | |
def clean(filename, whitelist=valid_filename_chars, replace=' '): | |
for r in replace: | |
filename = filename.replace(r,'_') | |
# keep only valid ascii chars |
This file contains hidden or 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
<html> | |
<head> | |
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous"> | |
</head> | |
<body> | |
<header> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script> | |
<style> | |
/* |
This file contains hidden or 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 feedparser | |
import sqlite3 | |
import os | |
from datetime import datetime | |
import json | |
""" | |
Small script to save links with dedup from rss-feeds for archiving with Squidwarc | |
usage: |
NewerOlder