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
ec2-describe-snapshots --filter tag:Name=OLDNAME | | |
awk '$1 == "SNAPSHOT" {print $2}' | | |
while read id ; do | |
ec2-create-tags $id --tag Name=NEWNAME | |
done |
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
#!/bin/sh | |
git log --pretty='SHA %H' --numstat | | |
awk '/^SHA/ {sha = $2} NF == 3 && $1 == 1 && $2 == 1 {print "git show --oneline --unified=0", sha, "--", $3}'| | |
sh | | |
sed -n '/^- /{;s/^-[ \t]*//;h;};/^+ /{s/^+[ \t]*//;H;g;s/\n/$/;p;}' | | |
sort | | |
uniq -c | | |
sort -rn | | |
head |
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
#!/bin/bash | |
# | |
# "Decompress" an MD5 sum into the file it represents. | |
# This was created following a tongue-in-cheek challenge by Tom Limoncelli. | |
# https://twitter.com/yesthattom/status/716670884698828800 | |
# | |
# Try md5decompress.sh c1a5298f939e87e8f962a5edfc206918 | |
# | |
if [ "x$1" = x ] ; then |
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
#!/bin/sed -Ef | |
# | |
# Add a LaTeX thin space (\,) decimal separator to long digit sequences | |
# | |
# Diomidis Spinellis, October 2018 | |
# | |
# Save this as a file and add it to your path, or run at as a one-liner: | |
# sed -E ':a;s/([0-9])([0-9]{3})([^0-9]|$)/\1\\,\2\3/g;ta' | |
# |
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
/* | |
* I add this to html files generated with pandoc. | |
*/ | |
html { | |
font-size: 100%; | |
overflow-y: scroll; | |
-webkit-text-size-adjust: 100%; | |
-ms-text-size-adjust: 100%; | |
} |
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
#!/usr/bin/env python | |
# | |
# Lock through a file using fcntl(2), i.e. lockf(3), rather than flock(2) | |
# as used in flock(1) | |
# | |
# Example: lockf /var/lib/dpkg/lock apt-get update | |
# | |
# Copyright 2018 Diomidis Spinellis | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); |
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
#!/usr/bin/env gvpr -f | |
# | |
# Given a directed graph and two specified nodes a, b succeed if | |
# node a is reachable from node b. | |
# The program exits with success (0) if a path is found and failure (1) | |
# if a path isn't found. | |
# | |
# Example invocation: | |
# gvpr -f reachable.gvpr -a sourcename -a targetname file.dot && echo yes | |
# |
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
/* | |
* 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> |
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
#!/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 |
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
#!/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 |
OlderNewer