This Gist includes some of the common AWS/IAM policy examples to give granular access to users.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCsrfToken() { | |
var parts = ('; ' + document.cookie) | |
.split("; csrf="); | |
if (parts.length === 2) { | |
const value = parts.pop().split(";").shift(); | |
return decodeURIComponent(value); | |
} | |
} | |
function sendXhr(url, method, data = null, headers = {}) { |
First get Docker installed and setup on machine. Once installed, create a new user e.g., metabase
for your installation using following command:
sudo adduser metabase
Now add the newly created user to docker
group, you won't need sudo
for docker ...
commands:
sudo usermod -aG docker metabase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CERTIFICATES=`openssl s_client -servername $1 -host $1 -port 443 -showcerts </dev/null 2>/dev/null | sed -n '/Certificate chain/,/Server certificate/p'` | |
CURSOR=$CERTIFICATES | |
while [[ "$CURSOR" =~ '-----BEGIN CERTIFICATE-----' ]] | |
do | |
CERTIFICATE="${CURSOR%%-----END CERTIFICATE-----*}-----END CERTIFICATE-----" | |
CURSOR=${CURSOR#*-----END CERTIFICATE-----} | |
echo `echo "$CERTIFICATE" | grep 's:' | sed 's/.*s:\(.*\)/\1/'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.lifecycle.LiveData | |
import androidx.lifecycle.MediatorLiveData | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.launch | |
fun <T> LiveData<T>.debounce(duration: Long = 1000L, coroutineScope: CoroutineScope) = MediatorLiveData<T>().also { mld -> | |
val source = this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function resize($el) { | |
const data = $el.data('center'); | |
if (data.x) { | |
const w_width = $(window).width(); | |
const e_width = $el.width(); | |
const margin = (w_width - e_width) / 2; | |
$el.css('left', margin) | |
} | |
if (data.y) { | |
const w_height = $(window).height(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
const handleLogout = () => { | |
axios.post('/logout') | |
.then(() => location.href = '/home') | |
}; | |
function Example() { | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const e = str => { | |
const replacements = { | |
'&': '&', | |
'<': '<', | |
'>': '>', | |
"'": ''', | |
'"': '"', | |
}; | |
return str.replace(/[&<>"']/g, match => replacements[match]) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Twig; | |
use Symfony\Component\HttpFoundation\RequestStack; | |
use Twig\Extension\AbstractExtension; | |
use Twig\TwigFunction; | |
class ActiveExtension extends AbstractExtension | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends 'bootstrap_4_horizontal_layout.html.twig' %} | |
{% block form_label_errors %}{% endblock %} | |
{% block form_row -%} | |
{%- if expanded is defined and expanded -%} | |
{{ block('fieldset_form_row') }} | |
{%- else -%} | |
<div class="form-group row{% if (not compound or force_error|default(false)) and not valid %} is-invalid{% endif %}"> | |
{{- form_label(form) -}} |
NewerOlder