Skip to content

Instantly share code, notes, and snippets.

View DonBattery's full-sized avatar

DonBattery DonBattery

View GitHub Profile
@DonBattery
DonBattery / Dockerfile
Last active December 19, 2019 20:13
Docker + docker-compose + authenticated gcloud sdk for GCP Container Optimized OS
# based on: https://hub.docker.com/r/dduportal/docker-compose/dockerfile
# Usage
# set DOCKER_HOST to the remote machine
# copy your gcp_credfile.json to pwd
# $ docker build -t my-compose .
# $ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock my-compose up -d --build --force-recreate
@DonBattery
DonBattery / gimme.sh
Last active July 8, 2020 14:52
Fast POC bootstrap with BASH
#!/usr/bin/env bash
set -eou pipefail
GIMME_DIR="${HOME}/dev/gimme"
LEGAL_PROJ_TYPES=("go" "bash" "js" "py")
function usage {
echo "
@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
@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)
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 / 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)
@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 / file1.txt
Created November 8, 2018 20:53
Created via API
Demo
@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