Skip to content

Instantly share code, notes, and snippets.

@mirzap
mirzap / auth-hook.js
Created July 19, 2021 14:45 — forked from ulises-jeremias/auth-hook.js
Examples of hooks utils using axios, recoil.js, keycloak-js, @react-keycloak/web and more.
import { useCallback, useEffect, useState } from 'react';
import { useSetRecoilState } from 'recoil';
import { useKeycloak } from '@react-keycloak/web';
import { commonNotification } from './common';
/**
* Returns the auth info and some auth strategies.
*
*/
@mirzap
mirzap / Dockerfile-es
Created July 12, 2021 11:26 — forked from wshayes/Dockerfile-es
Elasticsearch and Kibana using docker-compose (v3)
FROM docker.elastic.co/elasticsearch/elasticsearch:5.5.1
RUN \
mv /usr/share/elasticsearch/plugins/x-pack /usr/share/elasticsearch/plugins/.removing-x-pack && \
mv /usr/share/elasticsearch/plugins/.removing-x-pack /usr/share/elasticsearch/plugins/x-pack && \
/usr/share/elasticsearch/bin/elasticsearch-plugin remove x-pack
@mirzap
mirzap / ufw-glusterfs.conf
Created July 7, 2021 11:30 — forked from Diftraku/ufw-glusterfs.conf
UFW Application Profile for GlusterFS
[GlusterFS Daemon]
title=GlusterFS (Daemon)
description=GlusterFS Daemon
ports=24007/tcp
[GlusterFS Management]
title=GlusterFS (Management)
description=GlusterFS Management
ports=24008/tcp
@mirzap
mirzap / docker-compose.yaml
Created July 4, 2021 10:30 — forked from darth-veitcher/docker-compose.yaml
Traefik v2.0 with Cloudflare Wildcard and OpenVPN
version: "3"
services:
traefik:
image: "traefik:v2.0"
container_name: "traefik"
command:
# Globals
- "--log.level=DEBUG"
- "--api=true"
import React, { useEffect, useState } from 'react'
import PropTypes from 'prop-types'
import styled, { withTheme } from 'styled-components'
import { withSearch } from '@elastic/react-search-ui'
import _get from 'lodash/get'
import Slider from 'rc-slider'
import 'rc-slider/assets/index.css'
import { FacetContainer, FacetHeader } from './SearchFacet'
@mirzap
mirzap / Hasura Keycloak.md
Created January 6, 2021 10:39 — forked from webdeb/Hasura Keycloak.md
Basic Keycloak Script Mapper to provide Hasura claims

Steps to provide Hasura Claims in Keycloak generated JWT

  1. Create your realm / client
  2. Inside client configuration go to "Mappers"
  3. Click on "Create"
  4. Name it "hasura"
  5. Choose Mapper Type "Script Mapper"
  6. Add following script to demonstrate how it works
@mirzap
mirzap / foundation-menu.php
Created November 9, 2012 14:32 — forked from awshout/foundation4-topbar-menu.php
WordPress Walker for ZURB's Foundation Top Bar
add_theme_support('menus');
/*
http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus(array(
'top-bar-l' => 'Left Top Bar', // registers the menu in the WordPress admin menu editor
'top-bar-r' => 'Right Top Bar'
));
@mirzap
mirzap / machine.js
Created December 9, 2020 14:18
Generated by XState Viz: https://xstate.js.org/viz
const timerMachine = Machine({
id: "timer",
initial: "pending",
states: {
pending: {
onEntry: ["setDefaults"],
on: {
START: "running"
}
},
@mirzap
mirzap / node-user-agent.js
Created September 27, 2020 16:31 — forked from ninjascribble/node-user-agent.js
Fetching the user-agent string from a request using either NodeJS or NodeJS + Express
/** Native NodeJS */
var http = require('http')
, server = http.createServer(function(req) {
console.log(req.headers['user-agent']);
});
server.listen(3000, 'localhost');
/** NodeJS with Express */
var express = require('express')
@mirzap
mirzap / nginx.conf
Created May 25, 2020 15:20 — forked from CSRaghunandan/nginx.conf
Nginx configuration for serving mp4 videos
#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;