Skip to content

Instantly share code, notes, and snippets.

View DonBattery's full-sized avatar

DonBattery DonBattery

View GitHub Profile
@DonBattery
DonBattery / https-poc.yml
Last active July 28, 2018 00:28
given your 80 and 443 ports are forwarded, and yoursite.com points to your external IP <docker-compose -f https-poc.yml up> will start the hello-world webserver and it will be available on yoursite.com via HTTPS
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: NginX_Proxy
ports:
- 80:80
- 443:443
networks:
@DonBattery
DonBattery / .filekvs
Last active November 3, 2018 20:36
set the FILEKVS_DIRECTORY env, and source this file to get a file-based key:value store
# donbattery's poopdb
if [ ! -d "$FILEKVS_DIRECTORY" ]; then
printf "cannot find poopdb at %s\n" "$FILEKVS_DIRECTORY"
return
fi
filekvs_get () {
[ -f "$FILEKVS_DIRECTORY/$1" ] && printf "%s" "$(< "$FILEKVS_DIRECTORY/$1")"
}
@DonBattery
DonBattery / README.md
Last active November 3, 2018 23:24
Turbo Gists with python-gist and PoopDB

A wrapper for python-gist utility, using poopdb for named gists

https://pypi.org/project/python-gist/

You will need an access token from GitHub for python-gist, you can get one under
Settings > Developper Settings > Personal access tokens
Create a .gist file under your HOME folder like this:

[gist]
token: yourtoken
@DonBattery
DonBattery / file1.txt
Created November 8, 2018 20:53
Created via API
Demo
@DonBattery
DonBattery / file1.txt
Created November 8, 2018 20:55
Created via API
Demo
@DonBattery
DonBattery / file1.txt
Created November 8, 2018 20:55
Created via API
Demo
@DonBattery
DonBattery / piper.py
Created December 4, 2018 08:16
read lines from stdin (or pipe) and process them
#!/usr/bin/env python3
import fileinput
def process(line):
print(line)
for line in fileinput.input():
process(line)
var path = require('path');
module.exports = {
entry: path.resolve(__dirname, 'src') + '/app/index.js',
output: {
path: path.resolve(__dirname, 'dist') + '/app',
filename: 'bundle.js',
publicPath: '/app/'
},
@DonBattery
DonBattery / href.py
Created December 19, 2018 13:29
Python3 script to get href from HTML file
import fileinput
import re
def process(line):
result = re.search('href="(.*)"', line)
if result:
print(result.group(1))
for line in fileinput.input():
process(line)
@DonBattery
DonBattery / Dockerfile
Created December 15, 2019 08:25
Multistage Golang Dockerfile
FROM golang AS builder
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o my-app .
FROM alpine:latest