Skip to content

Instantly share code, notes, and snippets.

View YounesCheikh's full-sized avatar
🎯
Focusing

Younes CHEIKH YounesCheikh

🎯
Focusing
View GitHub Profile
@YounesCheikh
YounesCheikh / OldSchoolCliArgs.cs
Last active February 22, 2022 19:40
Very old school way to parse Command Line arguments to compare with the Cliargs.NET package
var userInputArgs = Environment.GetCommandLineArgs().Skip(1).ToArray();
if(userInputArgs.Length == 0)
{
Console.WriteLine("Missing mandatory arguments: --name");
return;
}
string name = string.Empty;
uint? age = null;
var currentKey = string.Empty;
@YounesCheikh
YounesCheikh / Program.cs
Created December 14, 2021 16:21 — forked from DanielSWolf/Program.cs
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@YounesCheikh
YounesCheikh / SecureStringHelperExtensions.cs
Created April 20, 2021 00:32
String to SecureString and SecureString to String converter
static class SecureStringConverter
{
public static SecureString ConvertToSecureString(this string password)
{
if (password == null)
throw new ArgumentNullException("password");
unsafe
{
fixed (char* passwordChars = password)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<IsPackagable>false</IsPackagable>
</PropertyGroup>
<ItemGroup>
<Reference Include="Routindo.Contract">
<HintPath>..\Libs\Routindo.Contract.dll</HintPath>
@YounesCheikh
YounesCheikh / functions.php
Created March 31, 2021 08:02
Enqueue child style
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'child-style', get_stylesheet_uri(),
array( 'parenthandle' ),
wp_get_theme()->get('Version') // this only works if you have Version in the style header
);
}
@YounesCheikh
YounesCheikh / DemoSetup.wixproj
Created November 1, 2020 00:21 — forked from dasMulli/DemoSetup.wixproj
Demo wix project to publish a self-contained .NET Core app
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>91e4dc15-312a-4e90-bc1c-01de5dc99447</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>CoreConsoleAppSetup</OutputName>
<OutputType>Package</OutputType>
@YounesCheikh
YounesCheikh / test.cs
Created July 19, 2017 08:44
just another test
Try
{
}
catch (Exception exception)
{
Log.Error(exception);
}
static void Main(string[] args)
{
string pattern = @"^\((0*([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5]),){2}0*([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\)$";
string input1 = @"(255,254,255)";
string input2 = @"my color is (255,254,255) in rgb";
input1 = Regex.Replace(input1, pattern, "MY_COLOR", RegexOptions.IgnoreCase);
input2 = Regex.Replace(input2, pattern, "MY_COLOR", RegexOptions.IgnoreCase);
Console.WriteLine(input1); // Result: "MY_COLOR"
Console.WriteLine(input2); // Result: "my color is (255,254,255) in rgb"
@YounesCheikh
YounesCheikh / sanae2.c
Created September 23, 2013 21:29
Now you can test your functions
typedef struct noeud {
int info;
struct noeud *fg, *fm, *fd;
} NOEUD;
typedef NOEUD ARBRE_TERNAIRE;
int taille( NOEUD *arbre) {
@YounesCheikh
YounesCheikh / sanae.c
Last active December 23, 2015 16:49
C'est à toi de finir :)
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>
#define MAX 300
int t[MAX];
int n;
// Exo 1