Skip to content

Instantly share code, notes, and snippets.

View dro248's full-sized avatar

David Ostler dro248

View GitHub Profile
@dro248
dro248 / postgres.sh
Created April 13, 2021 12:08 — 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
@dro248
dro248 / post-install-mint-ubuntu.sh
Created March 23, 2020 20:22 — forked from thiagomgo/post-install-mint-ubuntu.sh
Post-installation script for Linux Mint/Ubuntu
# Sudo without password
sudo visudo
username ALL=(ALL) NOPASSWD: ALL # At the end of the file
# Get the latest updates
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get -y upgrade
# Manage the repositories that you install
@dro248
dro248 / MSAccessJayDeBeAPI.py
Created February 20, 2020 04:55 — forked from pbdanny/MSAccessJayDeBeAPI.py
Use JayDeBeAPI with JDBC connect to MS Access
import jaydebeapi
# Initiate Java runtiome file location
ucanaccess_jars = [
"/Users/Danny/Documents/UCanAccess-4.0.2-bin/ucanaccess-4.0.2.jar",
"/Users/Danny/Documents/UCanAccess-4.0.2-bin/lib/commons-lang-2.6.jar",
"/Users/Danny/Documents/UCanAccess-4.0.2-bin/lib/commons-logging-1.1.1.jar",
"/Users/Danny/Documents/UCanAccess-4.0.2-bin/lib/hsqldb.jar",
"/Users/Danny/Documents/UCanAccess-4.0.2-bin/lib/jackcess-2.1.6.jar",
@dro248
dro248 / server.py
Created December 25, 2018 07:16 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@dro248
dro248 / directoryCloner.py
Last active June 18, 2018 14:29
Clones the structure of another directory
import os
import sys
import shutil
import logging
class DirectoryCloner:
"""
This class recursively creates a mirrored directory
with the same structure as the directory passed in.
@dro248
dro248 / SimpleHTTPServerWithUpload.py
Created December 10, 2017 16:59 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@dro248
dro248 / web-servers.md
Created November 11, 2017 18:38 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@dro248
dro248 / bluetooth raspberry-pi
Created November 9, 2017 20:11 — forked from lexruee/bluetooth raspberry-pi
install bluetooth and pybluez
sudo apt-get update
sudo apt-get install python-pip python-dev ipython
sudo apt-get install bluetooth libbluetooth-dev
sudo pip install pybluez
@dro248
dro248 / dummy-web-server.py
Created November 8, 2017 18:47 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@dro248
dro248 / Free O'Reilly Books.md
Created September 2, 2017 10:57 — forked from augbog/Free O'Reilly Books.md
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.