Skip to content

Instantly share code, notes, and snippets.

@nour-s
nour-s / IQueryableExtensions
Last active January 30, 2020 14:02 — forked from rionmonster/IQueryableExtensions
Resolve the SQL being executed behind the scenes in Entity Framework Core
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.Storage;
public static class IQueryableExtensions
{
private static readonly TypeInfo QueryCompilerTypeInfo = typeof(QueryCompiler).GetTypeInfo();
@hlaueriksson
hlaueriksson / Examples.cs
Last active November 12, 2023 21:19
PuppeteerSharp Documentation
using System;
using System.Threading.Tasks;
using NUnit.Framework;
namespace PuppeteerSharp.Contrib.Sample
{
public class Examples
{
async Task<IBrowser> Browser()
{
@ThomasLeister
ThomasLeister / rspamd-whitelisting.md
Last active February 15, 2025 06:19
How to whitelist IP addresses or domains in Rspamd

Whitelist IP addresses based on pre-filter policy

/etc/rspamd/local.d/multimap.conf:

  IP_WHITELIST {
      type = "ip";
      prefilter = true;
      map = "/${LOCAL_CONFDIR}/local.d/ip_whitelist.map";
 action = "accept";
@sasjo
sasjo / drain_jenkins.groovy
Last active June 29, 2025 17:15
Drain Jenkins build queue and stop all running jobs
Jenkins.instance.queue.items.findAll { !it.task.name.contains("Extenda") }.each {
println "Cancel ${it.task.name}"
Jenkins.instance.queue.cancel(it.task)
}
Jenkins.instance.items.each {
stopJobs(it)
}
def stopJobs(job) {
if (job in jenkins.branch.OrganizationFolder) {
// Git behaves well so no need to traverse it.
@LGM-AdrianHum
LGM-AdrianHum / JunctionPoint.cs
Last active July 15, 2025 15:14
Create, Delete and Examine Junction Points in C#
// File: RollThroughLibrary/CreateMaps/JunctionPoint.cs
// User: Adrian Hum/
//
// Created: 2017-11-19 2:46 PM
// Modified: 2017-11-19 6:10 PM
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
@agross
agross / Dockerfile
Last active November 7, 2023 01:44
Synology DS2415+ docker 17.05 does not support --build-arg
FROM busybox
ARG FOO
RUN env && echo $FOO
@SeanSobey
SeanSobey / portainer.md
Last active June 12, 2024 07:40
Portainer Setup on Windows 10

Portainer on Windows 10

Here I have 2 methods for running portainer on windows, a quick, preferred method only requiring a fairly recent version of docker, or a more complicated method to try if that does not work.

Using host.docker.internal

This setup will let you run Portainer on windows by using the host.docker.internal endpoint (docker.for.win.localhost is depricated since docker version 3.2.1, but older versions may use this instead).

Please note:

@b9chris
b9chris / BaseController.cs
Last active August 20, 2019 16:10
Asp.Net MVC BaseController that fixes a number of problems with the default MVC implementation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Web;
using System.Web.Mvc;
// Originally inspired by David Walsh (https://davidwalsh.name/javascript-debounce-function)
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// `wait` milliseconds.
const debounce = (func, wait) => {
let timeout;
return function executedFunction(...args) {
const later = () => {
@brizandrew
brizandrew / ajaxPromise.js
Created July 11, 2017 20:25
Wraps jQuery's ajax implementation inside an ES6 Promise structure.
// This code snippet requires jQuery to be loaded onto the page.
/**
* Wraps jQuery's ajax implementation inside an ES6 Promise structure.
* Source: https://stackoverflow.com/questions/35135110/jquery-ajax-with-es6-promises
* @function ajax
* @param {object} options - The config to pass to the ajax call.
* @return {object} - A Promise object to complete an ajax call.
*/
function ajax(options) {