Skip to content

Instantly share code, notes, and snippets.

View svnlto's full-sized avatar
🦙

Sven Lito svnlto

🦙
View GitHub Profile
@patst
patst / main.tf
Created May 4, 2022 07:01
postgres terraform provider delete issue
# start postgres db locally with:
# docker run --name postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=asdf123! -e POSTGRES_USER=pgadmin postgres:11
# cleanup with:
# PGPASSWORD=asdf123! psql -h 127.0.0.1 --no-password -p 5432 -U pgadmin --dbname mydb --command='DROP TABLE accounts'
terraform {
backend "local" {}
required_providers {
postgresql = {
source = "cyrilgdn/postgresql"
}
@jplew
jplew / README.md
Last active April 3, 2023 01:14
How to Setup SSH and GPG keys with Gitlab
#!/bin/sh
# SetDNS.sh
#
#
# Created by David Kittell on 6/14/19.
#
# Variables - Start
sExternalIPService="http://dns.kittell.net/ip.php"
@jpbecotte
jpbecotte / Vue-cli-3-Phoenix-1.3-HOWTO.md
Last active August 23, 2020 05:32
Vue-cli 3, Phoenix 1.3, a complete how-to

Introduction

I have been struggling to start a new project with Phoenix 1.3 and the new vue-cli 3 for Vue.js. There are tons of example already but none of them suited my needs, because:

  • I want to use the new Vue-cli to select the features that I want,
  • I do NOT want to setup Webpack (I know, what a shame!). The new Vue-cli includes the new vue-cli-service, which uses an instance of webpack-dev-server, so you don't have to import it manually in your project.
  • I do not want to use Brunch.

Create your Phoenix App

Assuming that you have Elixir and Phoenix 1.3 are both installed, let's build our new App.

@jswny
jswny / Flexible Dockerized Phoenix Deployments.md
Last active July 3, 2023 05:25
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

@hardbyte
hardbyte / Automated TLS certificates on k8s.md
Last active September 17, 2018 22:00
Free automated TLS certificates on k8s

Cross posted from blog.n1analytics.com

At N1 Analytics we use Kubernetes for running experiments, continuous integration testing and deployment. In this post I document setting up a Kubernetes cluster to automatically provision TLS certificates from Let's Encrypt using Jetstack's Certificate Manager, the helm package manager and the nginx-ingress controller.

I wrote this after migrating our cluster from traefik to use cert manager and nginx-ingress. The end state will be one where we can create Kubernetes ingress with a TLS certificate with only a set of annotations in the respective helm template.

I'm going to assume some background knowlege for this post, if you haven't heard of [Let's Encrypt](https://letsencrypt.org/abou

@teamon
teamon / box.ex
Created August 25, 2017 23:09
Define elixir structs with typespec with single line of code
defmodule Box do
defmacro __using__(_env) do
quote do
import Box
end
end
@doc """
Define module with struct and typespec, in single line
@samlandfried
samlandfried / auth0-pid-access-token-retrieval.md
Created July 23, 2017 18:44
Learn how to retrieve a user's access token to an identity provider with Auth0

Auth0 and ID Provider Access

How to Get API Access Tokens to Services You Authenticate With

What?

Auth0 is an incredible tool with a wide range of capabilities for anyone building a web app that relies on storing and authenticating users. It's the AWS of user management via oauth (Although I imagine AWS has some service that takes care of that). The documentation on Auth0 is similarly comprehensive. I found a homegrown tutorial on their site that covered everything I needed to do (When you create a new app, you answer a few questions to describe the type of app you're building and what technology you're using, and it serves the exact tut you need). Even with Auth0 pushing the limit of what a service can do to make it easy for their users to dive in, I spent a solid 2 days trying to get everything working together. Hopefully, this blog can help you clear one hurdle quicker than me.

What I won't talk about

I'm not going to talk about how to authenticate users with Auth0. That's step 1, and it rea

@gyandeeps
gyandeeps / run.js
Last active April 17, 2018 13:56
Parallel run test for ESLint
const workerFarm = require("worker-farm");
const FARM_OPTIONS = {
maxConcurrentWorkers : require('os').cpus().length
, maxCallsPerWorker : Infinity
, maxConcurrentCallsPerWorker : 1
};
const workers = workerFarm(FARM_OPTIONS, require.resolve("./worker"));
let ret = 0;
@giautm
giautm / feathersjs-dataloader.js
Created March 7, 2017 15:39
Use facebook's dataloader to batch any Service get
'use strict';
const DataLoader = require('dataloader');
class Service {
constructor({ BaseService, options }) {
this.id = BaseService.id || 'id';
this.service = BaseService;
this.dataloader = new DataLoader(this._batchGet.bind(this), options);