Skip to content

Instantly share code, notes, and snippets.

View sefacan's full-sized avatar

Sefa Can sefacan

View GitHub Profile
@sefacan
sefacan / minikube.md
Created October 21, 2023 11:10 — forked from rahulkumar-aws/minikube.md
Install/Uninstall Minikube from Mac
minikube stop; minikube delete
docker stop $(docker ps -aq)
rm -r ~/.kube ~/.minikube
sudo rm /usr/local/bin/localkube /usr/local/bin/minikube
systemctl stop '*kubelet*.mount'
sudo rm -rf /etc/kubernetes/
docker system prune -af --volumes
@sefacan
sefacan / userscript.js
Created January 6, 2022 21:30 — forked from tarikguney/userscript.js
Eat Your Food - Netflix Interruptor
// ==UserScript==
// @name Remember to eat your food while watching Netflix
// @namespace https://www.tarikguney.com
// @version 0.1
// @description Kids watching cartoons on Netflix often forget to eat and chew their food, which drives parents crazy. You need to sit down with them and pause the video and remind them to eat their food. This script will automate that.
// @author Tarik Guney
// @match https://www.netflix.com/watch/*
// @icon https://upload.wikimedia.org/wikipedia/commons/thumb/7/75/Netflix_icon.svg/1200px-Netflix_icon.svg.png
// @grant none
// ==/UserScript==
@sefacan
sefacan / NginxReloadBug
Created September 24, 2020 14:08 — forked from sun4lower/NginxReloadBug
nginx: [error] invalid PID number "" in "/var/run/nginx.pid"
pkill -9 nginx
nginx -c /etc/nginx/nginx.conf
nginx -s reload
using Newtonsoft.Json.Linq;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web.Mvc;
using System.Web.Script.Serialization;
namespace Admin.Controllers
/*!
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.
*/
/*
@sefacan
sefacan / LegacyHostEnvironment.md
Created February 25, 2020 07:27 — forked from RickStrahl/LegacyHostEnvironment.md
Masking IWebHostEnvironment in .NET Core 2.x for operation like 3.x

IWebHostingEnvironment is not available in .NET Core 2.x, but in 3.x it's the recommended way to access the host environment with threat of IHostingEnvironment being removed in the future. This can be a problem in libraries that need to run both on 2.x and 3.x.

The following tries to mask the differences in a multi-targeted .NET Core project by creating a custom IWebHostEnvironment implementations that picks up values from IHostingEnvironment in 2.x.

#if NETCORE2
using Microsoft.Extensions.FileProviders;

namespace Microsoft.AspNetCore.Hosting
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Html;
using Newtonsoft.Json;
namespace HtmlHelpers
{
/// <summary>
using Microsoft.AspNetCore.Html;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
namespace MyApp.HtmlHelpers
{
@sefacan
sefacan / completion-suggester.cs
Created December 25, 2019 21:16 — forked from russcam/completion-suggester.cs
Using Completion Suggester with NEST
void Main()
{
var indexName = "stackoverflow";
var node = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var settings = new ConnectionSettings(node)
.InferMappingFor<Question>(m => m
.IndexName(indexName)
)
.PrettyJson()
.DisableDirectStreaming()
@sefacan
sefacan / mongodb-ssl.sh
Created November 26, 2019 14:42 — forked from kevinadi/mongodb-ssl.sh
Script to create self-signed CA certificates, server certificates, and client certificates for testing MongoDB with SSL
#!/bin/sh
# Generate self signed root CA cert
openssl req -nodes -x509 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=root/CN=`hostname -f`/emailAddress=kevinadi@mongodb.com"
# Generate server cert to be signed
openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=server/CN=`hostname -f`/emailAddress=kevinadi@mongodb.com"
# Sign the server cert