Skip to content

Instantly share code, notes, and snippets.

View dspinellis's full-sized avatar

Diomidis Spinellis dspinellis

View GitHub Profile
@dspinellis
dspinellis / cp1250-to-cp1253.bas
Last active August 7, 2023 02:27
Old Microsoft Word Greek document fixer
'
' Old Microsoft Word Greek document fixer
'
' Copyright 2023 Diomidis Spinellis
'
' Licensed under the Apache License, Version 2.0 (the "License");
' you may not use this file except in compliance with the License.
' You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
@dspinellis
dspinellis / make-prettierignore.sh
Created July 13, 2022 15:30
Which (auto-generated and third-party) files should @prettiercode ignore?
comm -13 <(git ls-files | sort) <(yarn prettier --check . 2>&1 | sed -n 's/\[warn\] //p' | sort) >.prettierignore
@dspinellis
dspinellis / cytrox-check.sh
Last active May 29, 2022 14:39
Display host names of Cytrox spyware-hosting sites visited with Firefox
#!/usr/bin/env bash
#
# Display host names of Cytrox spyware-hosting sites visited with Firefox
# See: https://github.com/AmnestyTech/investigations/tree/master/2021-12-16_cytrox
#
# Diomidis Spinellis, May 2022
#
if [ -z "$1" ] ; then
echo "Usage: $0 /path/to/Firefox/places.sqlite" 1>&2
@dspinellis
dspinellis / Makefile
Last active March 5, 2022 14:16
Add a help target for any Makefile
URL=https://www.spinellis.gr/unix
love: # Help: Create a file name love
touch love
money: # Help: Hit the jackpot
yes $$ | fmt | head
me a wizard: MOOC # Help: Become a Unix command-line wizard
@dspinellis
dspinellis / pending-reviews.sh
Last active September 21, 2021 09:41
List the caller's pending GitHub pull request reviews
#!/bin/sh
#
# List the caller's pending GitHub pull request reviews
#
user=$(git config github.user)
gh pr list --json number,title,reviewRequests -q '.[] | select(.reviewRequests | any(.login == "'$user'")) | ["#" + (.number|tostring), .title] | @tsv'
@dspinellis
dspinellis / wrong-greek-n-endings.sh
Created May 16, 2021 20:19
Show lines (and color) endings that violate the Greek final-n omission rule
#!/bin/sh
#
# Show lines (and color) endings that violate the Greek final-n omission rule
# Exit with a 0 success error code if such lines were found
#
egrep -i --color '\<(αυτήν|την|δεν|μην) ([^κπτξψαεηιουωάέήίόύώϊϋΐΰμνγ]|μ[^π]|ν[^τ]|γ[^κ])'
@dspinellis
dspinellis / anagrams.sh
Created April 24, 2021 15:25
Find all anagrams in the system's dictionary
#!/bin/sh
#
# Find all anagrams in the system's dictionary by mapping the words
# into a product of prime numbers associated with each letter
#
# Process plain ASCII characters
export LC_ALL=C
# Create commands for the calculator bc
@dspinellis
dspinellis / third-person.sed
Last active June 11, 2020 12:43
Convert code review text to third person singular
#!/bin/sed -Ef
#
# Convert code review text to third person singular
# Author: Diomidis Spinellis, June 2020
# Released to the public domain
#
# you write -> the code contains
s/\<you write/the code contains/g
@dspinellis
dspinellis / sapi-speech-to-text.cpp
Created October 8, 2019 10:30
Command-line tool to convert speech in a WAV audio file into text using Windows SAPI
/*
* Convert the specified speech WAV file into text output
* on the program's standard output.
*
* Diomidis Spinellis, October 2019
* Based on https://stackoverflow.com/a/40002268/20520
*/
#include <iostream>
#include <sapi.h>