Skip to content

Instantly share code, notes, and snippets.

View sefacan's full-sized avatar

Sefa Can sefacan

View GitHub Profile
@moogii
moogii / api.ts
Created August 8, 2021 16:50
Axios based Next js client and server side token refresher
import axios, { AxiosError } from "axios";
import { GetServerSidePropsContext } from "next";
import Router from "next/router";
const isServer = () => {
return typeof window === "undefined";
}
let accessToken = "";
let context = <GetServerSidePropsContext>{};
@pauldotknopf
pauldotknopf / HomeController.cs
Last active October 21, 2022 12:23
Render .NET Core ASP.NET MVC ViewComponent to string from controller
public class HomeController : Controller
{
public async Task<string> RenderViewComponent(string viewComponent, object args)
{
var sp = HttpContext.RequestServices;
var helper = new DefaultViewComponentHelper(
sp.GetRequiredService<IViewComponentDescriptorCollectionProvider>(),
HtmlEncoder.Default,
sp.GetRequiredService<IViewComponentSelector>(),
@ueokande
ueokande / benchmark-commands.md
Last active January 22, 2024 12:38 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \
@gnepud
gnepud / gist:4cac79b5e5f5053c1fd6
Last active September 4, 2022 10:09
docker elasticsearch / kibana install plugin
# elasticsearch
docker run --rm -v "$PWD/esdata":/usr/share/elasticsearch/data -v "$PWD/esdata/plugins":/usr/share/elasticsearch/plugins elasticsearch /usr/share/elasticsearch/bin/plugin install marvel-agent
docker run -d -v "$PWD/esdata":/usr/share/elasticsearch/data -v "$PWD/esdata/plugins":/usr/share/elasticsearch/plugins -p 9200:9200 -p 9300:9300 --name=elasticsearch elasticsearch
# kibana
mkdir -p kibana/installedPlugins
chmod 777 -R kibana
docker run --rm -v "$PWD/kibana/installedPlugins":/opt/kibana/installedPlugins --link some-elasticsearch:elasticsearch kibana kibana plugin --install elasticsearch/marvel/latest
docker run -d --name kibana -v "$PWD/kibana/installedPlugins":/opt/kibana/installedPlugins --link some-elasticsearch:elasticsearch -p 5601:5601 kibana
/*!
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:robert@broofa.com
Copyright (c) 2010 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
/*