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
# Make sure to install 'jsonschema' as well as any validator packages, | |
# such as 'rfc3339-validator', that are used by the schema. | |
import json | |
import sys | |
import urllib.request | |
import urllib.error | |
import jsonschema | |
def main(): |
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
# Dmitry Brant, 2023 | |
import requests | |
def cleanupForCsv(s): | |
return s.replace("\"", "”").replace("'", "’").replace("\r", " ").replace("\n", "") | |
apiBaseUrl = "https://www.wikidata.org/w/api.php?format=json&formatversion=2&" | |
continueStr = "" | |
userEditCounts = {} |
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
# Dmitry Brant, 2023 | |
import requests | |
import urllib | |
def parseDescription(content): | |
description = "" | |
sStart = content.lower().find("{{short description|") | |
if sStart != -1: | |
sEnd = content.find("}}", sStart) |
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
function deleteMessageIfEmpty() { | |
var threads = GmailApp.search('is:unread in:inbox') | |
for (const thread of threads) { | |
const messages = thread.getMessages() | |
if (messages.length != 1) { continue; } | |
const msg = messages[0]; | |
const words = msg.getPlainBody().trim().split(" "); |
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
(Dmitry Brant, Apr 2022) | |
Recently I came across a backup tape (an AIT-3 100GB tape) that was written with a format | |
I didn't recognize. The only thing I knew is that it came from a Mac workstation, which means | |
it was likely written using Retrospect, which was a popular backup tool at the time. | |
This is the result of my reverse-engineering effort to get the contents out of this archive. | |
------------------ | |
This backup format is composed of a sequence of blocks which use FourCC-style formatting. | |
(All data is big-endian. Dates are formatted as seconds since Jan 1 1904.) |
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 csv | |
from google.cloud import storage | |
# To install Google Cloud dependency: | |
# pip install --upgrade google-cloud-storage | |
# Private key to use for authenticating our service account: | |
key_file = 'playStoreAccessKey.json' | |
# Bucket name for our data (copy from Play Store Console): |
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
UPDATE wp_posts SET post_content = REPLACE(post_content, '“', '“'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, 'â€', '”'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, '’', '’'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, '‘', '‘'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, '—', '–'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, '–', '—'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, '•', '-'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, '…', '…'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, '…', '…'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, 'Â', ' '); |
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 os | |
import sys | |
import pickle | |
from googleapiclient.discovery import build | |
from googleapiclient.http import MediaFileUpload | |
from google_auth_oauthlib.flow import InstalledAppFlow | |
from google.auth.transport.requests import Request | |
directoryIndexMap = {} |
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 smtplib | |
server = smtplib.SMTP("smtp.gmail.com", 587) | |
server.ehlo() | |
server.starttls() | |
server.ehlo() | |
server.login("account@example.com", password) | |
msg = "To: destination@example.com\n" | |
msg += "From: source@example.com\n" | |
msg += "Subject: " |
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
REM You can put this batch file on your Desktop, and drag-and-drop ARC files into it! | |
REM It will automatically create a folder with the same name as the ARC file, extract the files into it, and delete the original ARC file. | |
mkdir "%~p1\%~n1" | |
move %1 "%~p1\%~n1" | |
cd "%~p1\%~n1" | |
E:\cygwin\bin\arc.exe x "%~p1\%~n1\%~n1.arc" | |
del "%~p1\%~n1\%~n1.arc" |
NewerOlder