Skip to content

Instantly share code, notes, and snippets.

@denza
denza / registrations_controller.rb
Created November 9, 2019 05:13 — forked from jwo/registrations_controller.rb
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@denza
denza / main.rb
Created May 30, 2019 10:29
Track site response times
#!/usr/bin/env ruby
# Used for liveness probe of web location
#
# @example
# #Makes 4 requests to url location
# ruby main.rb https://gitlab.com
#
# #Makes 10 request to url location, -n option is used
# ruby main.rb https://gitlab.com -n 10
@denza
denza / kubectl-shortcuts.sh
Created April 5, 2019 02:00 — forked from tamas-molnar/kubectl-shortcuts.sh
aliases and shortcuts for kubectl
alias kc='kubectl'
alias kclf='kubectl logs --tail=200 -f'
alias kcgs='kubectl get service -o wide'
alias kcgd='kubectl get deployment -o wide'
alias kcgp='kubectl get pod -o wide'
alias kcgn='kubectl get node -o wide'
alias kcdp='kubectl describe pod'
alias kcds='kubectl describe service'
alias kcdd='kubectl describe deployment'
alias kcdf='kubectl delete -f'
@denza
denza / go-build-all
Created February 6, 2019 10:27 — forked from eduncan911/go-build-all
Go Cross-Compile Script
#!/bin/bash
#
# GoLang cross-compile snippet for Go 1.6+ based loosely on Dave Chaney's cross-compile script:
# http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go
#
# To use:
#
# $ cd ~/path-to/my-awesome-project
# $ go-build-all
#
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
# Unzip
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
#Install docker
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@denza
denza / kube-registry.yaml
Created August 24, 2018 02:31 — forked from coco98/kube-registry.yaml
Docker registry on minikube
apiVersion: v1
kind: ReplicationController
metadata:
name: kube-registry-v0
namespace: kube-system
labels:
k8s-app: kube-registry
version: v0
spec:
replicas: 1
make testacc
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -timeout 120m
? github.com/terraform-providers/terraform-provider-profitbricks [no test files]
=== RUN TestAccDataSourceDatacenter_matching
--- PASS: TestAccDataSourceDatacenter_matching (41.75s)
=== RUN TestAccDataSourceImage_basic
--- PASS: TestAccDataSourceImage_basic (10.28s)
=== RUN TestAccDataSourceLocation_basic
--- PASS: TestAccDataSourceLocation_basic (4.77s)
@denza
denza / make website-test
Created May 8, 2018 09:58
make website-test
echo "github.com/hashicorp/terraform-website not found in your GOPATH (necessary for layouts and assets), get-ting..."
github.com/hashicorp/terraform-website not found in your GOPATH (necessary for layouts and assets), get-ting...
git clone https://github.com/hashicorp/terraform-website /src/github.com/hashicorp/terraform-website
Cloning into '/src/github.com/hashicorp/terraform-website'...
remote: Counting objects: 162836, done.
remote: Compressing objects: 100% (96/96), done.
remote: Total 162836 (delta 80), reused 71 (delta 40), pack-reused 162700
Receiving objects: 100% (162836/162836), 124.22 MiB | 1.22 MiB/s, done.
Resolving deltas: 100% (104071/104071), done.
Checking connectivity... done.