This file contains 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
-- Generates a diagram of table schema relationships in | |
-- GraphViz DOT format (https://graphviz.org/doc/info/lang.html) | |
-- via a SQLite query | |
-- To run: | |
-- > sqlite3 path/to/database.db -init sqlite-schema-diagram.sql "" > schema.dot | |
-- > dot -Tsvg schema.dot > schema.svg | |
-- Fork of: https://gitlab.com/Screwtapello/sqlite-schema-diagram/ |
This file contains 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
'''This script can be used to export data from Pocket (getpocket.com) | |
Uses include migrating to a different "read it later" service, saving | |
specific articles to another service, backing up your reading history, | |
and more. | |
Currently it can be used to export links and metadata for archived | |
articles with a given tag, which are more recent than a given timestamp. | |
An example use case is to export all articles you have tagged as | |
"to-export", which are newer than 10 days old. The timestamp functionality |
This file contains 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
def getchar(): | |
#Returns a single character from standard input | |
import tty, termios, sys | |
fd = sys.stdin.fileno() | |
old_settings = termios.tcgetattr(fd) | |
try: | |
tty.setraw(sys.stdin.fileno()) | |
ch = sys.stdin.read(1) | |
finally: | |
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) |
This file contains 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 email, getpass, imaplib, os | |
detach_dir = '.' # directory where to save attachments (default: current) | |
user = raw_input("Enter your GMail username:") | |
pwd = getpass.getpass("Enter your password: ") | |
# connecting to the gmail imap server | |
m = imaplib.IMAP4_SSL("imap.gmail.com") | |
m.login(user,pwd) | |
m.select("cs2043") # here you a can choose a mail box like INBOX instead |
This file contains 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
''' | |
This script performs efficient concatenation of files stored in S3. Given a | |
folder, output location, and optional suffix, all files with the given suffix | |
will be concatenated into one file stored in the output location. | |
Concatenation is performed within S3 when possible, falling back to local | |
operations when necessary. | |
Run `python combineS3Files.py -h` for more info. | |
''' |
This file contains 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 queue import PriorityQueue | |
from collections import Counter | |
from dataclasses import dataclass, field | |
from typing import Any | |
@dataclass(order=True) | |
class Node: | |
count: int | |
value: Any=field(compare=False) |
This file contains 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
# coding: utf-8 | |
"""Simple declarative schema migration for SQLite. | |
See <https://david.rothlis.net/declarative-schema-migration-for-sqlite>. | |
Author: William Manley <will@stb-tester.com>. | |
Copyright © 2019-2022 Stb-tester.com Ltd. | |
License: MIT. | |
""" |
This file contains 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
/* | |
* Script to automate sending the monthly debt emails. | |
*/ | |
var EMAIL_RECEPIENT = "example@gmail.com" | |
var COLUMNS = { | |
"date": 0, | |
"paid": 1, | |
"total": 2, |
This file contains 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
// Original source: https://github.com/mimoo/eureka/blob/master/folders.go | |
package main | |
import ( | |
"archive/tar" | |
"bytes" | |
"compress/gzip" | |
"fmt" | |
"io" | |
"os" |
This file contains 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
// Small exploration into the ease of implementing an interface (and server) to abstract | |
// away the complexities of dealing with cumbersome and non-standardized network | |
// protocols. | |
// | |
// The resulting server exposes a simple HTTP API to clients, routing and forwarding | |
// their requests behind the scenes to a collection of raw network streams. The goal | |
// is to hide the underlying communication protocol and network multiplexing from | |
// clients, instead exposing a simple request/response API spoken in the lingua franca | |
// of the web. | |
// |
NewerOlder