Skip to content

Instantly share code, notes, and snippets.

View looselycoupled's full-sized avatar

Allen Leis looselycoupled

  • United States
View GitHub Profile
@palewire
palewire / README.md
Last active June 17, 2024 06:05
How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

Here's how I configured a GitHub Action so that a new version issued by GitHub's release interface will build a Dockerfile, tag it with the version number and upload it to Google Artifact Registry.

Before you attempt the steps below, you need the following:

  • A GitHub repository that contains a working Dockerfile
  • The Google Cloud SDK tool gcloud installed and authenticated

Create a Workload Identity Federation

# Powerlevel9k config
POWERLEVEL9K_MODE='nerdfont-complete'
POWERLEVEL9K_SHORTEN_DIR_LENGTH=3
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=''
POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR=''
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='%F{blue}\u256D\uf07c %F{white}'
@awjuliani
awjuliani / SimplePolicy.ipynb
Created September 11, 2016 00:20
Policy gradient method for solving n-armed bandit problems.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@christopheranderton
christopheranderton / macosx-contextmenu-automator-touch.md
Last active February 3, 2024 17:45
Add a simple ”Touch” Service to your context menu (Right-Click Menu) in MacOS X (Tested in Mac OS X 10.10.5, but should work in older and newer versions as well) with Automator.app
  1. Open up Automator.app located in your Applications folder.
  2. Choose ”Service” in the dialog sheet when creating a new document.
  3. In the Services receives selected: menu at the top of the ”Canvas” on the right, change to ”Files & Folders”.
  4. In the sidebar to the left, search for Get Selected Finder Items
  5. Drag this Action to the ”canvas” on the right side.
  6. Again, go to the sidebar at the left and this time search for Run Shell Script
  7. Drag the Run Shell Script action to the ”canvas” on the right side.
  8. At the right in the Run Shell Script action, change the Pass input from to stdin to as arguments
  9. Copy paste this into the action text box, removing the Cat command in the text box:
@iMilnb
iMilnb / boto3_hands_on.md
Last active October 19, 2022 09:15
Programmatically manipulate AWS resources with boto3 - a quick hands on

boto3 quick hands-on

This documentation aims at being a quick-straight-to-the-point-hands-on AWS resources manipulation with [boto3][0].

First of all, you'll need to install [boto3][0]. Installing it along with [awscli][1] is probably a good idea as

  • [awscli][1] is boto-based
  • [awscli][1] usage is really close to boto's
@bbengfort
bbengfort / clock.py
Last active August 29, 2015 14:09
A simple date time string printing program.
#!/usr/bin/env python
# clock
# Prints out the time specially formatted
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Sat Mar 08 15:29:47 2014 -0500
#
# Copyright (C) 2014 Bengfort.com
# For license information, see LICENSE.txt
#
@bbengfort
bbengfort / storemongo
Created June 17, 2014 18:12
Backup mongo to s3
#!/bin/bash
# Dumps the Mongo Database and exports it to S3
# Make sure to run this script in the background! (nohup)
WORKING_DIRECTORY="/mnt/vol-604be929/tmp/data"
if [ ! -d "$WORKING_DIRECTORY" ]; then
mkdir -p $WORKING_DIRECTORY
fi
@erichurst
erichurst / US Zip Codes from 2013 Government Data
Created December 9, 2013 23:00
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source: http://www.census.gov/geo/maps-data/data/gazetteer.html
This file has been truncated, but you can view the full file.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158345, -66.932911
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.445147, -66.559696
00622,17.991245, -67.153993
@goldsmith
goldsmith / numpy_os_x_10_9.sh
Last active January 6, 2024 07:25
How to install Numpy and Scipy on Mac OS X Mavericks (10.9) using Pip.
# set up flags for Numpy C extentions compiling
export CFLAGS="-arch i386 -arch x86_64"
export FFLAGS="-m32 -m64"
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64"
export CC=gcc-4.2
export CXX="g++ -arch i386 -arch x86_64"
pip install numpy
# success!