Skip to content

Instantly share code, notes, and snippets.

Economopoulos_2_4 {
S = A + "c"
A = B + D + "a" | D + B + "a"
B = "b"
D = "d"
}
@gpwclark
gpwclark / postgres.sh
Created September 1, 2023 20:30 — forked from mrw34/postgres.sh
Enabling SSL for PostgreSQL in Docker
#!/bin/bash
set -euo pipefail
openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod 600 server.key
test $(uname -s) = Linux && chown 70 server.key
docker run -d --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -v "$(pwd)/server.crt:/var/lib/postgresql/server.crt:ro" -v "$(pwd)/server.key:/var/lib/postgresql/server.key:ro" postgres:12-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
@gpwclark
gpwclark / playground.rs
Last active December 6, 2022 21:38 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use futures::{StreamExt as _, stream};
use tokio::time::sleep;
use tokio::time::{Instant, Duration};
async fn loopnprint(name: &str) -> Result<(), String> {
let now = Instant::now();
loop {
sleep(Duration::from_millis(101)).await;
let elapsed = Instant::now() - now;
if name == "task2" && elapsed > Duration::from_millis(1230) {

Keybase proof

I hereby claim:

  • I am gpwclark on github.
  • I am uofantarcticaedu (https://keybase.io/uofantarcticaedu) on keybase.
  • I have a public key whose fingerprint is 4AC9 8695 CD95 BB93 2AF8 E5CA 900B 1FDD 4E08 7FB5

To claim this, I am signing this object:

@gpwclark
gpwclark / gist:7af6397f3e5990f99045b4c31a57db61
Created June 21, 2018 17:58 — forked from jasoet/gist:3843797
Database Connection Singleton
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.secondstack.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
#!/bin/bash
# Adapted from paradigm's strata setup instructions on
# bedrocklinux.org
# Viva Bedrock Linux!
if [ $# -eq 0 ]; then
echo "No arguments provided"
exit 1
fi
@gpwclark
gpwclark / filenameScrambler.java
Created May 24, 2016 22:55
This is a java program that takes a filepath (to a folder... arg1) and randomly renames the files in the folder with a UUID, each randomly renamed file is given the same extension (arg2).
package main;
import java.io.File;
import java.util.UUID;
/*
* This is a java program that takes a filepath (to a folder... arg1)
* and randomly renames the files in the folder with a UUID, each
* randomly renamed file is given the same extension (arg2).
*
* 1st argument is "/the/filepath"
@gpwclark
gpwclark / Dockerfile-clojure
Created February 6, 2016 03:03
dockerfile for clojure development
FROM clojure
MAINTAINER gpwclark
# install necessary programs
RUN apt-get update && apt-get install -y \
git \
wget \
vim \
tmux \
libssl-dev \
FROM ubuntu
MAINTAINER gpwclark
RUN apt-get update && apt-get install -y \
git \
wget \
vim \
tmux \
libssl-dev \
curl \
@gpwclark
gpwclark / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console