Skip to content

Instantly share code, notes, and snippets.

View jtdowney's full-sized avatar

John Downey jtdowney

View GitHub Profile
@jtdowney
jtdowney / ecb.md
Last active September 1, 2020 20:06
Create ECB pattern images

This gist describes how to use the ImageMagick and OpenSSL command line tools to encrypt an image using ECB mode.

First we need to gather some information about the original image. This will tell us what size to use in our final step.

$ identify Braintree.png
Braintree.png PNG 898x229 898x229+0+0 8-bit sRGB 65KB 0.000u 0:00.000

Looks like the image is 898x229.

Next we need to convert the image into the RGBA format. This is a simple binary format that only contains uncompressed pixel data and no meta information, like image dimensions.

# i3 config file (v4)
set $mod Mod4
font pango:Hack 10
floating_modifier $mod
focus_follows_mouse no
bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Shift+q kill
bindsym $mod+d exec dmenu_run
@jtdowney
jtdowney / Dockerfile
Created January 10, 2019 15:44
Simple dockerfile for OpenJDK 11
FROM debian:stretch-slim
ENV OPENJDK_MAJOR=11
ENV OPENJDK_VERSION=11.0.1
ENV JAVA_HOME=/opt/jdk-${OPENJDK_VERSION}
ENV PATH=$JAVA_HOME/bin:$PATH
ADD https://download.java.net/java/GA/jdk${OPENJDK_MAJOR}/13/GPL/openjdk-${OPENJDK_VERSION}_linux-x64_bin.tar.gz /tmp/
RUN tar -C /opt -xf /tmp/openjdk-${OPENJDK_VERSION}_linux-x64_bin.tar.gz
#[macro_use]
extern crate error_chain;
extern crate regex;
mod errors {
error_chain! {
foreign_links {
Io(::std::io::Error);
Regex(::regex::Error);
ParseChar(::std::char::ParseCharError);
#[macro_use]
extern crate error_chain;
mod errors {
error_chain! {
foreign_links {
Io(::std::io::Error);
ParseInt(::std::num::ParseIntError);
}
}
#[macro_use]
extern crate error_chain;
mod errors {
error_chain! {
foreign_links {
Io(::std::io::Error);
ParseInt(::std::num::ParseIntError);
}
}
@jtdowney
jtdowney / day22.rs
Last active December 22, 2017 15:20
#[macro_use]
extern crate itertools;
use std::collections::HashMap;
use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader};
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
struct Point(isize, isize);
#[macro_use]
extern crate error_chain;
mod errors {
error_chain! {
foreign_links {
Io(::std::io::Error);
}
}
}
#[macro_use]
extern crate error_chain;
mod errors {
error_chain! {
foreign_links {
Io(::std::io::Error);
ParseInt(::std::num::ParseIntError);
}
}
@jtdowney
jtdowney / day19.rs
Last active December 19, 2017 18:50
use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader};
#[derive(Copy, Clone, Debug)]
enum Direction {
Up,
Down,
Left,
Right,