Skip to content

Instantly share code, notes, and snippets.

View alekpopovic's full-sized avatar
🏠
Working from home

Aleksandar Popovic alekpopovic

🏠
Working from home
View GitHub Profile
@alekpopovic
alekpopovic / README.md
Created September 16, 2023 21:24 — forked from vavdoshka/README.md
ArgoCD and ArgoWorkflows SSO config with AWS Cognito

ArgoCD and ArgoWorkflows SSO config with AWS Cognito

So you have fantastic ArgoCD or mind-boggling ArgoWorkflows (this guide covers both), and if you want to secure the Authentication with AWS Cognito, let's dive right in.

I found many different sources unveiling some pieces of the required configuration but no resources where one can see the whole picture. I hope this guide will be one of such places. This guide will mean no DEX usage, just rely on Argo's built-in OpenID Connect flow.

Table of contents

@alekpopovic
alekpopovic / Install update WordPress puglins directly.md
Created August 2, 2023 08:06 — forked from dianjuar/Install update WordPress puglins directly.md
Install update WordPress plugins without providing ftp access

Install WordPress plugins directly (without FTP)

Put this on your wp-config.php

/* That's all, stop editing! Happy blogging. */
define('FS_METHOD', 'direct');
@alekpopovic
alekpopovic / change_author_git_commit.md
Created May 22, 2023 21:37 — forked from albertodebortoli/change_author_git_commit.md
Change the author of a commit in Git

Using Interactive Rebase

git rebase -i -p <some HEAD before all of your bad commits>

Then mark all of your bad commits as "edit" in the rebase file, and when git asks you to amend each commit, do

git commit --amend --author "New Author Name <[email protected]>"

edit or just close the editor that opens, and then do

@alekpopovic
alekpopovic / unicorn.rb
Created May 18, 2023 11:33 — forked from kripy/unicorn.rb
Heroku Sequel Fork
# Using Sequel with Sinatra (Unicorn) on Heroku and getting this error:
# Sequel::DatabaseDisconnectError - PG::ConnectionBad: PQconsumeInput() SSL error: decryption failed or bad record mac.
# Need to do some forking.
# In unicorn.rb:
worker_processes 4 # amount of unicorn workers to spin up
timeout 30 # restarts workers that hang for 30 seconds
preload_app true # avoid regeneration of jekyll site for each fork
before_fork do |server, worker|
Signal.trap 'TERM' do
@alekpopovic
alekpopovic / Makefile
Created May 16, 2023 15:27 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@alekpopovic
alekpopovic / README.md
Created March 27, 2023 10:41 — forked from jesster2k10/README.md
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.

I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)

Before trying it out DIY, I considered using:

@alekpopovic
alekpopovic / obj.html.erb
Created March 15, 2023 13:01
ruby varst to js object
<%=
name = "Aleksandar"
age = 41
city = "Mozgovo"
%>
<script>
var object = JSON.parse('{"name":"<%= name %>", "age":"<%= age %>", "city":"<%= city %>"}')
console.log(object)
</script>
@alekpopovic
alekpopovic / create-vanilla-cluster.sh
Created March 12, 2023 01:50 — forked from fgauna12/create-vanilla-cluster.sh
Create vanilla AKS cluster with Azure CNI and Virtual Network
#!/bin/bash
set -ex
echo "Creating cluster with base name $1 on $2"
if [ -z "$1" ]
then
echo "Please provide the name of the cluster."
exit -1
@alekpopovic
alekpopovic / kube_service_create.sh
Created February 7, 2023 23:02 — forked from ganesh-karthick/kube_service_create.sh
PgAdmin Kubernetes service depoyment example
#!/usr/bin/env bash
kubectl create -f pgadmin.yaml
sleep 15s
kubectl logs pgadmin-76gjgvvjh-yghg
## Access pgAdmin
## https://<IP>:31560
## username/password: [email protected] / password
@alekpopovic
alekpopovic / heroku-remote.md
Created January 25, 2023 12:43 — forked from randallreedjr/heroku-remote.md
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git