Skip to content

Instantly share code, notes, and snippets.

@helstern
helstern / .kubesh.sh
Last active April 13, 2023 12:11
Allows a different kubectl current-context for each shell process when sourced from .bashrc, for example
#shellcheck shell=bash
# Debug
#[[ -n $DEBUG ]] && set -x
export KUBE_SESSION_KUBECONFIG
export KUBE_SESSION_HOME=${KUBE_SESSION_HOME:-"${HOME}/.kube-session"}
function _KUBE_SESSION_INIT() {
@helstern
helstern / kurl.sh
Last active March 27, 2023 18:12
Quick http proxy for kubernetes services and pods
#!/usr/bin/env bash
# install this url parser
# go install github.com/rsdoiel/urlparse/cmds/urlparse@latest
# install gnu coreutils
# brew install coreutils
set -e
@helstern
helstern / Makefile
Last active September 4, 2019 13:31
ruby container
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_ROOT := $(dir $(mkfile_path))
PROJECT_NAME := $(basename $(PROJECT_ROOT))
docker-build-2.5:
docker build --tag rhelstern-ruby:2.5.5 --file ruby-2.5.Dockerfile .
docker-build-2.3:
docker build --tag rhelstern-ruby:2.3.3 --file ruby-2.3.Dockerfile .
dash_id=xxxx
api_key=xxx
app_key=xxx
# 1. export
curl -X GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${api_key}&application_key=${app_key}" > dash.json
# 2. edit dash.json
move "graphs", "title", "description" up one level in the json hierarchy, from being beneath "dash" to being at the same level
@helstern
helstern / install-redis-cli.sh
Last active February 4, 2019 11:43
latest redis-cli
// these should already be installed
// apt get install libjemalloc1 libjemalloc-dev gcc make
cd /tmp
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
cp src/redis-cli /usr/local/bin/
chmod 755 /usr/local/bin/redis-cli

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@helstern
helstern / README.md
Created February 20, 2017 22:51 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
https://github.com/mitchellh/vagrant/issues/5199
rm .vagrant/machines/default/virtualbox/synced_folders
vagrant reload
Vagrant.configure("2") do |config|
config.trigger.after [:reload, :halt], stdout: true do
`rm .vagrant/machines/default/vmware_fusion/synced_folders`
end
end
@helstern
helstern / gist:8378d2a1fa11d924f003e4c8d3796da1
Created April 10, 2016 22:08
start local xdebug session
php -dxdebug.remote_autostart=on -dxdebug.remote_enable=1 vendor/bin/phpunit
#sudo apt-get remove maven2
sudo add-apt-repository "deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main"
sudo apt-get update
sudo apt-get install maven3
#If you encounter this:
#The program 'mvn' can be found in the following packages:
# * maven
# * maven2