Skip to content

Instantly share code, notes, and snippets.

View jbielick's full-sized avatar

Josh Bielick jbielick

View GitHub Profile
[Accounts]
deprovision_remove = false
gpasswd_add_cmd = gpasswd -a {user} {group}
gpasswd_remove_cmd = gpasswd -d {user} {group}
groupadd_cmd = groupadd {group}
groups = adm,dip,docker,lxd,plugdev,video
useradd_cmd = useradd -m -s /bin/bash -p * {user}
userdel_cmd = userdel -r {user}
[Daemons]
# ...
[InstanceSetup]
host_key_types = ecdsa,ed25519,rsa
set_host_keys = false
# ...
build {
sources = ["sources.googlecompute.sftp"]
provisioner "file" {
source = "files/hostkeys.tar.gz"
destination = "/tmp/hostkeys.tar.gz"
}
# https://github.com/GoogleCloudPlatform/guest-agent#configuration
# guest-agent overwrites our hostkeys, so we turn that off
provisioner "file" {
source = "files/instance_configs.cfg"
source "googlecompute" "sftp" {
project_id = "my-project"
source_image_family = "debian-10"
ssh_username = "packer"
machine_type = "n1-standard-2"
disk_size = 50
zone = "us-east1-d"
subnetwork = "default"
image_name = "sftp-{{timestamp}}"
}

Keybase proof

I hereby claim:

  • I am jbielick on github.
  • I am jbielick (https://keybase.io/jbielick) on keybase.
  • I have a public key whose fingerprint is D46E C6EA 05A4 33C0 DA8D DB21 3DA8 A86A 1E1E F5D5

To claim this, I am signing this object:

@jbielick
jbielick / git_sync.py
Last active October 11, 2023 09:02
an Apache Airflow DAG to sync a git repository to the google cloud storage bucket for your Composer environment
from datetime import datetime, timedelta
from airflow.models import Variable
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
private_key = Variable.get("git_deploy_private_key_secret")
repo_url = Variable.get("git_remote_url")
default_args = {
@jbielick
jbielick / dot-env-conflict-help
Created November 20, 2017 16:49
If you're using `transcrypt(1)` in your repo and you have merge conflicts, things get a little messy. This short script can help with auto-merging the file with a few user-verified steps.
#!/usr/bin/env bash
set -e
file=$1
# before anyones changes
common=$(git --no-pager show ":1:$file")
# your changes
ours=$(git --no-pager show --textconv ":2:$file")
@jbielick
jbielick / geojson
Last active April 16, 2016 14:17
download, convert, clean, import US tiger shapefiles into RethinkDB tables.
objects=zcta5 county concity
tiger_url=ftp://ftp.census.gov/geo/tiger/TIGER2015
zcta5: zcta5.import
county: county.import
concity: concity.import
%.import: %.geo.json
rethinkdb import -f $< --table geo.$*
@echo '$* import complete'
@jbielick
jbielick / app.js
Last active August 29, 2015 14:10
Example of Node.js forking and maintaining debug port for worker.
var path = require('path');
var child_process = require('child_process');
var currentFork;
var timesStarted = 0;
function fork(){
var args = process.argv.slice(2),
execArgs = process.execArgv,
isDebug = process.execArgv.indexOf('--debug');
@jbielick
jbielick / app.js
Last active August 29, 2015 14:10
Example of the difficulty in attaching a debugger to Node.js cluster forks if they're cycled (development environments)
var cluster = require("cluster");
var worker;
if (cluster.isMaster) {
function spawnWorker(i) {
var child;
cluster.settings.execArgv || (cluster.settings.execArgv = []);
// this has no effect
cluster.settings.execArgv.push('--debug=' + 5859);